I am just getting my feet wet in Forms and JS. I am trying to make the following function run against a form button click to fill out some fields in a form.
The name works ok but the date is loading a decimal into the text field. Can anyone assist?
Solved! Go to Solution.
try to enclose date formula into apostrophes like
NWF$('#'+ jsvar_PMDate).val("fn-FormatDate(Current Date, MM/dd/yyyy)");
I'm not sure why do you get a number there, but in my env. your formula didn't work at all.
could be that in your env. the output is evaluated as a math expression and so you see result of 3 digits divided.
When I added double quotes or single quotes around the function, I got the literal string of the function populating my text box.
Hi Kapil Joshi,
I worked with it some more and it turns out that Marian Hatala's solution worked for me. Not sure why it did not work the first time I tried it. Perhaps I was troubleshooting too many issues at once on the form.
//this line renders a deciaml:
NWF$('#'+ jsvar_PMDate_txt).val(fn-FormatDate(Current Date, MM/dd/yyyy));
//This line renders the propper date format:
NWF$('#'+ jsvar_PMDate_txt).val("fn-FormatDate(Current Date, MM/dd/yyyy)");
Here is where and how it rendered...