- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 10:07 AM
Hi,
My task is that on Change request form, Planned start date field should be 24 hours ahead of Current time.
I need to write a client Script for this.
Below mentioned is my script, if I put in the wrong date, error message comes up but goes away and does not stays on the form screen. Can anyone help with why it is happening?
function onSubmit(){
//Type appropriate comment here, and begin script below
var start = g_form.getValue('start_date');
var today = new Date();
today.setDate(today.getDate());
if (start.toString() <= today.toString()){
g_form.addErrorMessage("Planned Start Date cannot be less than 24 hrs ahead in future.");
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 10:13 AM
Please modify your code like below
function onSubmit(){
//Type appropriate comment here, and begin script below
var start = g_form.getValue('start_date');
var today = new Date();
today.setDate(today.getDate());
if (start.toString() <= today.toString()){
g_form.addErrorMessage("Planned Start Date cannot be less than 24 hrs ahead in future.");
return false;
}
}
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 10:32 AM
ok got it thanks