how to add checkbox and radio button fields in a form ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2016 10:25 AM
Hi,
I want to add checkboxes and radio button in my form, do you have any idea how to do that ?
I check in google and the wiki of servicenow but it existe like a variable in catalog item, in my case i want to add them in my own interface.
thank you.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 03:29 AM
Hi guys, I would like to know how to do this also. Surely there must be an easy way to create a radio button or checkbox to any bespoke application? Are these really only available in Service Catalog? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2016 10:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2016 10:52 AM
I can think of this - not implemented anything like this myself and not sure how useful it could / would be
Can look at creating a UI Macro + UI Formatter and go from there
certainly cannot use any onChange routine
take the ui macro - ui_radio as your basis
(I have not experimented with the onchange or onclick options so they can probably go)
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:macro id="${jvar_name}_${jvar_value}" name="" value="" text="" checked_value="" onchange="" />
<j:if test="${jvar_value == jvar_checked_value}">
<label>
<input type="radio" id="a" name="test" title="a" value="a" checked="checked"
onchange="${jvar_onchange}"
onclick="${jvar_onchange}">
A
</input><br/>
<input type="radio" id="b" name="test" title="b" value="b"
onchange="${jvar_onchange}"
onclick="${jvar_onchange}">
B
</input><br/>
<input type="radio" id="c" name="test" title="c" value="c"
onchange="${jvar_onchange}"
onclick="${jvar_onchange}">
C
</input><br/>
</label>
</j:if>
<j:if test="${jvar_value != jvar_checked_value}">
<label>
<input type="radio" id="${jvar_id}" name="${jvar_name}" title="${jvar_text}" value="${jvar_value}"
onchange="${jvar_onchange}"
onclick="${jvar_onchange}">
${jvar_text}
</input>
</label>
</j:if>
</j:jelly>
create a ui formatter and attach to a form
An onSubmit Script
this.strA;
this.strB;
this.strC;
function onSubmit() {
//Type appropriate comment here, and begin script below
$$('[id=a]').each(function(elmt) {
this.strA = elmt.checked;
});
$$('[id=b]').each(function(elmt) {
this.strB = elmt.checked;
});
$$('[id=c]').each(function(elmt) {
this.strC = elmt.checked;
});
alert(this.strA + ' : ' + this.strB + ' : ' + this.strC);
}
and then on save

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2019 09:26 PM
hi
here true/false type
Thanks,
Rahul Kumar