- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2017 10:48 AM
Hi,
I have a lookup select box and i want to reset it to element 0 of the select box or ---None---(which is the original value on load) when another selectbox value is changed.
Can anyone advise me what should i use?
I tried to set value or add option but none of it resets it to the default none value for the selectbox.
g_form.setValue('name',0);
g_form.addoption('name', "", '---None---', '0');
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2017 11:29 AM
Hi Wayner,
I think it is much more simple:
g_form.setValue('name', '');
For instance: an onChange script that changes priority to --none-- once the state field is changed:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue)
g_form.setValue('priority', '');
}
harel
Edit:
If you want the value to be '0', then:
1. make sure that you have one of your options in the choice field with a value of 0
2. the line should be: g_form.setValue('name', '0'); //the 0 should be between ' '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2017 11:29 AM
Hi Wayner,
I think it is much more simple:
g_form.setValue('name', '');
For instance: an onChange script that changes priority to --none-- once the state field is changed:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue)
g_form.setValue('priority', '');
}
harel
Edit:
If you want the value to be '0', then:
1. make sure that you have one of your options in the choice field with a value of 0
2. the line should be: g_form.setValue('name', '0'); //the 0 should be between ' '
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2017 12:19 PM
Thanks alot Harel.
Your method works. i was trying to set it as element 0 but somehow it doesnt work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2018 10:50 AM
Hi Wayner,
Do you need still help with the 0 thing?
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2018 03:47 PM
Hello Harel,
All good. i just needed to reset it to the default none.
Thanks.
Cheers.