- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2016 05:23 PM
Hi Team,
Please find the below snippet i used to validate the date field to select only the current and future date.
But the problem is im unable to select the current date.
Please guide where i m wrong.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var today = new Date();
var dateMS = today.getTime();
var current_date = new Date();
current_date.setTime(dateMS);
var new_date = new Date(getDateFromFormat(newValue, g_user_date_time_format));
g_form.setValue('ftr_needed_by',formatDate(current_date,g_user_date_time_format));
if(new_date>=current_date)
{
// this is valid
}
else{
alert("selected date should be current date or future date");
g_form.setValue('axa_asia_ph_var_date_needed','');
}
}
Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2016 03:38 AM
Hi,
Rather than client script use the following UI policy with the following condition :
Write following script :
function onCondition() {
g_form.setValue('date_of_joining', "'');
alert("Enter valid date");
}
Its simple and works in all the cases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2016 08:11 PM
Many Thanks Harneet...Its working short n sweet