Searched - but not found.
How to get the number of the actual day, like "dayofyear"?
I want to know if the actual day is after 31.03. (day 91) and before 01.10. (day 274).
Leap Year doesnt matter .
Hope you can help me.
Greetings - jurgen
-please replace #ff_elem8574 with ID of textfield which is for calendar
To find ID do the right click to browser and in Console find ID for this element
When you click on this textfield you will see calendar
3) go to form->Advanced->More options->Scripts->Initialization script->check Custom and put:
function ff_formname_init()
{
setInterval('calc()', 500);
} // ff_formname_init
function calc() {
var now=new Date(ff_getElementByName('nameoftextfieldforcalendar').value);
var start=new Date(now.getFullYear(), 0, 0);
var diff = now - start;
var oneDay = 1000 * 60 * 60 * 24;
var day = Math.floor(diff / oneDay);
ff_getElementByName('nameoftextfieldforcountdayofyear').value=day;
}
Please replace:
-formname with name of your form (not title)
-nameoftextfieldforcalendar with name of textfield for calendar (not title)
-nameoftextfieldforcountdayofyear with name of textfield for cound day of year (not title)
Basically, this works on way when you select some day in calendar in other textfield you will see number of day of the year
If you get in stuck let me know, and I will help
Regards,
Tihana
Thanks Tihana - it seems to complicated for me, maybe u know how to find a smart code.
BreezingForms 1.9.1 Stable (build 941)
I need a code to find out if it is winter or summer as descriped.
I have an unused database-Field, if needed:
einnahmen_dusche varchar(6) utf8_general_ci Ja NULL
Neither I know where to put the code nor I have any idea to integrate this.
The decision summer/winter has to been defined after the client enter a date in a fomular.
After input field "Anreise" (anreise varchar(10) utf8_general_ci, type date) I can put a code in fieldoptions to define "summer" (maybe field einnahmen_dusche).
Then I have different fields which need to "know" if it is summer or winter. Because we have different cost in our hut on summer or winter. Winter we need more heating and warm water .
Actually our code:
var betrag = (5.00 * value * bfField ('anzahl_naechte'));
value = betrag.toFixed(2);
ff_getElementByName("gebuehren_em").value = value;
Our "wished" code:
//summer is between 1. april and 30. september
if <summer>
var betrag = (5.00 * value * bfField ('anzahl_naechte'));
else
var betrag = (6.00 * value * bfField ('anzahl_naechte'));
Maybe we check on-the-fly the field anreise for every needed field if it is summer or winter?
this is "smart" code, it is not too complicated, if you want I can create an example on your page, but then I need your backend link and login information
Use this tag:
[confidential]
[/confidential]
I will integrate it for you in a small example that you can check how it works
About summer, winter, I need to test this, and let you know, please give me some time
I dive deeper in java and find a java online-testconsole.
The rest has been try an error.
Here the final code for the numerous day of year:
const now = new Date();
// anreise is my database-field when someone visit the first day our little hut
var heute=new Date(ff_getElementByName('anreise').value);
var starttag=new Date(now.getFullYear(), 0, 0);
var diff = now - starttag;
var oneDay = 1000 * 60 * 60 * 24;
var day = Math.floor(diff / oneDay);
// stored in my field
ff_getElementByName('DayOfYear').value=day;
We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.
How to receive the discount:
Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!
Live Support Chat Opened!
Join our Discord chat here and enter the Crosstec channels to receive live support and talk directly to the team!