
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2018 04:27 PM
Hello,
I'm after some guidance on how to achieve the following. We have a catalog item on our service portal, part of the form is below:
The bottom half of the form is made up of the 3 check boxes, now each checkbox has an underlying set of questions, see the screen shot below:
The issue I have is this, if a user selects the "SIM Card" checkbox as shown in the screen shot above, I want the default value for the "New/Replacement SIM" question to be New, which it is, the problem is as the default value is "New" even if the user doesn't select the SIM Card checkbox the "New or Replacement SIM" variable is still set as "New" the default value, this then means I get the next screen shot when looking at the request item (the screen shot is for the Mobile Phone question, but the issue is the same)
Now what I would like to achieve is have no default variables set until the user selects the checkbox, so going back to the "SIM Card" checkbox, if the user doesn't select the "SIM Card" checkbox, the "New or Replacement SIM" variable doesn't have a default value (and therefore doesn't show in the options panel of the request item), but if the user does select the "SIM Card" checkbox, then the "New or Replacement SIM" variable should have the default value of "New".
I hope that all makes sense, and if not let me know and I will try and better explain the issue.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2018 01:59 AM
Hi
The best way to do control this in a client script running onChange on the SIM Card variable
In the client script do someting like this
if (newValue == false) {
//Clear all radio buttons when checkbox is cleared
g_form.setValue('new_var','');
g_form.setValue('replace_var','');
g_form.setValue('cancel_var','');
return;
}
var new = g_form.getValue('new_var');
var replace = g_form.getValue('replace_var');
var cancel = g_form.getValue('cancel_var');
//Set default value if no radio button is selected
if (new == '' && replace == '' && cancel == '')
g_form.setValue('new_var',true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2018 01:59 AM
Hi
The best way to do control this in a client script running onChange on the SIM Card variable
In the client script do someting like this
if (newValue == false) {
//Clear all radio buttons when checkbox is cleared
g_form.setValue('new_var','');
g_form.setValue('replace_var','');
g_form.setValue('cancel_var','');
return;
}
var new = g_form.getValue('new_var');
var replace = g_form.getValue('replace_var');
var cancel = g_form.getValue('cancel_var');
//Set default value if no radio button is selected
if (new == '' && replace == '' && cancel == '')
g_form.setValue('new_var',true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2018 02:15 AM
Hi Lars,
We use many of these "onChange" client scripts on our catalog items, and now we are thinking of making the catalog available :
- on service portal (today it is only available on CMS and back office)
- on mobile
Will these client scripts still work fine?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2018 02:36 AM
Hi
Yes they will work, but there are certain limitations - see here for details: Service Portal Documentation

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2018 06:52 PM
Lars,
Sorry for the delay in responding. This was exactly what I was after.
Thanks.