onChange client script to display confirmation message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2016 04:45 PM
Hi ,
I ma working on a onChange client script to display error message. Below is my script, when I select the Value '4' and submit the from the from it should display a info message with options 'Yes' and 'No' , when select 'Yes' for should be updated with value 4 otherwise old value. Any help would be appreciated.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === ''){
return;
}
var val = g_form.getValue('state');
if(val == '4')
{
g_form.addInfoMessage("Please Confirm that the task should be move back");
}
else {
g_form.setValue('state',oldValue);
}
}
thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2016 05:20 PM
Hi,
confirm is the method you want to use. That will give the user an "OK" or "cancel".
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === ''){
return;
}
var val = g_form.getValue('state');
if(val == 4){
var answer = confirm("Please Confirm that the task should be move back");
if (answer == false){
g_form.setValue('state', oldValue);
}
}
}
Tone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2016 08:09 PM
Thank you Antone,
It i working fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2016 03:26 AM
Great! be sure to mark the answer as correct if you can.
Best,
Tone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2016 09:03 PM
Hi,
in validation part you are using
If(val=='4')
it will treat as string .So change it to val==4 and try
Thanks
Pradeep D J