How to use UI Page in OnSubmit client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 04:33 AM - edited 01-16-2023 08:43 AM
Hi All,
Please help me on below issue
How to validate UI Page value in Onsubmit
OnSubmit:
function onSubmit() {
if (g_form.getActionName() == "resolve_incident") {
var gm = new GlideModal('confirm_changes');
gm.setTitle('Confirm');
gm.setWidth(400);
gm.render();
if(user clicked on 'Do Change' button )
{
g_form.setReadonly('field 1',false);
g_form.setReadonly('field 2',false);
g_form.addErrorMessage("Change values on fields");
return false;
}
if(user clicked on 'Confirmed' button)
{
validateDates();
return true;
}
function checkManagers()
{
if(........)
{
return false;
}else{
return true;
}
}return true;
}
}
}
HTMl :
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<p>Are you sure about your changes ?</p>
<br/>
<div style="float: right">
<g:dialog_buttons_ok_cancel ok="return sendvalue()" ok_type="button" ok_text="Confirmed" ok_style_class="btn btn-primary" cancel="return destroyWindow()" cancel_type="button" cancel_text="Do Change" cancel_style_class="btn btn-default" />
</div>
</j:jelly>
Client script :
function sendvalue {
destroyWindow();
return true;
}
function destroyWindow() {
GlideDialogWindow.get().destroy();
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 03:16 AM
Hello @Supriya25 ,
You can use location.reload() method and for daving the form you can use g_form.save() method
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 12:15 AM
Let me try "location.reload()"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 04:25 AM
Hi Omkar,
Can we reduce the this marked space ?
HTML :
<g:ui_form>
<div id = "message_area" style="min-height: 75px; overflow: hidden;" />
<input type="hidden" id="inc_SysID" name="inc_SysID"/>
<input type="hidden" id="tableName" name="tableName"/>
<input type="hidden" id="operational_catgry" name="operational_catgry"/>
<div class="row">
<div>
<p><span style="padding:16px;"> Note: if you want cahnge Operational Category select below </span></p>
<span style="padding:16px;font-weight:bold;"> Select Operational Category : </span>
<td style="width:55%">
<g:ui_choicelist name="operational_category" id="operational_category" table="incident" mandatory="true" field="u_operational_category" query="active=true"/>
</td>
</div>
</div>
<div>
<span style='color: red;' id="error_msg" class="outputmsg_text"></span>
</div>
<!-- action buttons -->
<div class="modal-footer">
<span class="pull-right">
<g:dialog_buttons_ok_cancel ok="CloseWindow('ok')" cancel="return ChangeValue()" cancel_text="change"/>
</span>
</div>
</g:ui_form>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 05:01 AM
@Supriya25 Pleasecheck by removing this
<div class="row"> <div>
Can you please mark Helpful and Correct and Close this thread. IF i was able to help you in your case.
Thank you,
Omkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 06:21 AM
Hello @Supriya25 ,
Can you please modify below client script in ui page
function sendvalue() {
destroyWindow();
return true;
}