clearoptions() and removeoptions() not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2016 09:29 AM
Hi All,
Based on the conditions, i need to add/remove options from the choice data type fields. I have written 2 scripts. one script is working as expected but in second script it is not clearing the options eventhough it is going into the loop( i have checked by using alert). And i have checked all the field names and choice values.
What could be the possible reason for this behaviour and how to fix this issue?
Thanks and regards,
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2016 11:11 AM
Please share your 2 scripts so that we can see what may be happening.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 01:57 AM
Hi David,
Thanks for you reply.
script which is working: i have writen on state field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue != '1')// choice value of deployed is 1
{
g_form.clearOptions('u_abc');
}
else
{
if(newValue == '1')
{
//g_form.addOption('u_usage_type', '-- None --', '-- None --');
g_form.addOption('u_abc', 'Dedicated', 'Dedicated');
}
if(newValue != '1')
{
g_form.setValue('u_abc','');
}
}
}
Script which is not working:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if ( newValue == '') {
return;
}
if(newValue == 'abc')
{
g_form.clearOptions('u_xyz');
g_form.clearValue('u_uvw');// clearing is working but options are still visible
}
else
{
g_form.clearOptions('u_xyz');
g_form.addOption('u_xyz', '--None--', '--None--');
g_form.addOption('u_xyz', 'Active', 'Active');
}
if(newValue == 'Owned')
{
g_form.setValue('u_xyz','');
}
}
Regards,
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 03:01 AM
Options will be visible, if you want to clear the options as well then use ClearOptions functionin the script, You are just clearing the value specified on that field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2016 03:24 AM
Oh.. actually i mean the script is clearing the values in u_uvw but it is not clearing the options in u_xyz field eventhough i have used clearOptions() function.
Regards,
Swamy
