onchange client script in catalog form to clear the entered text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 02:32 AM
Hi
I want to write a client script for clearing the entered text in variable of catalog item
Whenever we are selecting "others" then "please specify" field will be displayed and we are going to enter the required text.
If we are going to select different option rather than "others" and again selecting "Others" then the previous entered text remains same.
Can anyone helpme out to write a Onchange client script for clearing those entered text for the above scenario.
Regards,
Dhanush
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 02:37 AM
I believe you could do this with an UI policy checking that Team is changed and by having a ui policy action set the please specify empty with "clear value".
You can also do this with a onChange client script checking the Teams variable and using g_form.clearValue('<please_specify_variable_name>'); or g_form.setValue('<please_specify_variable_name>', '');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 03:07 AM
Hi @Dhanush Rao K ,
Write an "onChange" Client script on change of "Team" variable. Try the below script -
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue != 'others') {
g_form.clearValue('please_specify');
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 03:58 AM
I couldnt able to enter the text in "please specify" field while executing this script
While entering the text it is automatically getting cleared
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2024 04:22 AM
@Dhanush Rao K ,
Can you share screenshot of how you have written your client script.