- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 07:44 AM
Hi All,
How can we hide radio button option on the basis of users country code.
I tried using g_form.removeOption() but it doesn't worked.
What do we use to hide Radio Button option in client script?
Note : Also tried using -
if(result == 'US')
{
//g_form.removeOption('phone','Iphone 7','iphone');
var radiobtn = document.getElementsByName("myid");
//radiobtn.checked = true;
radiobtn.style.visibility="hidden";
radiobtn.style.display="none";
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 07:47 AM
I wouldn't use DOM manipulation for this. You could do a select box and use g_form.removeOption().
Please mark this as correct/helpful if this resolved your issue!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 08:23 AM
Hi Meenal,
This onload script will do the job.
//This assumes that your variable is named "safe_request_type" and your option value is "architecture"
function onLoad() {
if (!g_user.hasRole("itil")){
showRadio("safe_request_type","architecture",false);
}
function showRadio(strVarName, strOption, bVisible){
var myOptions = g_form.getControl(strVarName).up(1).getElementsByTagName("label");
for (var i=0;i<myOptions.length;i++){
var element = myOptions[i].getElementsByTagName("input")[0];
if (element.value == strOption){
element.hidden=!bVisible;
myOptions[i].hidden=!bVisible;
break;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 08:26 AM
Hi Rahul,
Thanks for replying.
Will try on above and let you know accordingly.
Thanks and Regards,
Meenal