Checkbox in Popup Messgae
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 04:36 AM
Hello All,
I have requirement to show Check box value in pop up message.
Right under the message checkbox should come up.
When checkbox value is checked/unchecked it should be saved in User Submitted fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 07:57 AM
Hi,
You can have a look at the UI Pages, but this is advanced configuration.
Having the checkbox in the HTML field within the g:ui_form. Something like this:
<div><input type="checkbox" id="agreement" name="agreement" value="I agree" onchange="verifyAgreement()">  I have read these conditions and agree</input></div>
<div id="buttons">
<div style="margin-top:10px; float:right">
<g:dialog_buttons_ok_cancel ok="return true" cancel="onCancel(); return false;"/>
</div>
</div>
A client script activating / deactivating the OK button
$j( document ).ready(function() {
$('ok_button').setAttribute('disabled','true');
});
function verifyAgreement(){
var agreement = $('agreement').checked;
if(agreement)
$('ok_button').removeAttribute("disabled");
else
$('ok_button').setAttribute('disabled','true');
}
And then you can choose to process it client or serverside (via the processing script). Example of a processing script:
processAgreement();
function processAgreement(){
//Check the agreement checkbox first, if checked, update your
var gr = new GlideRecord('<sometable>');
if(gr.get(currentSysId)){
gr.setValue('u_agreed', true);
gr.setValue('state', 2);
gr.update();
}
var urlOnStack = gs.getSession().getUrlOnStack();
response.sendRedirect(urlOnStack);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 08:18 AM
Helo Hayo, I am trying checkbox from SpModal. Can it be done?