- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 09:35 AM
Hello
I need help auto-populating the current date on a form using onChange.
This is my current script and I just need the current date to display on the above form , I attempted
var fecha = new Date();
alert(fecha);
Not sure if that is the correct way . Thank you
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 10:24 AM
Try below code:
var today = new Date();
var todayStr = formatDate(today, g_user_date_format);
g_form.setValue("your_date_field", todayStr);
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 10:23 AM
Can you share the script instead of screenshot if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 10:45 AM
this is the script
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if(g_form.getValue('state')=='
g_form.setValue('u_reporting_
g_form.setValue('u_affected_
g_form.setValue('u_reported_
if(g_form.getValue('date')!='
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 10:24 AM
Try below code:
var today = new Date();
var todayStr = formatDate(today, g_user_date_format);
g_form.setValue("your_date_field", todayStr);
Aman Kumar