How to use UI Page in OnSubmit client script

Supriya25
Tera Guru

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();

 

image.png


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;
}
}

}

Supriya25_0-1673872105865.png

 

 

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;

}

 

 

 

13 REPLIES 13

Hello @Supriya25 ,

You can use location.reload() method and for daving the form you can use g_form.save() method

OmkarKumbhar_0-1673954153237.png

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

Let me try "location.reload()"

Hi Omkar,

 

Can we reduce the this marked space ?

Supriya25_0-1674475756813.png

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>

 

@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

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @Supriya25 ,

Can you please modify below client script in ui page 

function sendvalue() {

    destroyWindow();

    return true;

}

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.