OK and Cancel not working on ui page

surya123
Mega Guru

Hi All

My script is 

 

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">
<g:ui_form>
Number  <g:ui_reference name="ritm" id="ritm" table="sc_req_item" completer="AJAXTableCompleter" />
User: <g:ui_reference name="user" id="user" table="sys_user" completer="AJAXTableCompleter"/>
</g:ui_form>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td align="left" nowrap="true"><br />
<g:dialog_buttons_ok_cancel ok="return validateForm()" cancel ="return OnCancel"/>
</td></tr>
</table>

</j:jelly>

 

Client script

function onCancel() {
var c = gel('cancelled');
c.value = "true";
GlideDialogWindow.get().destroy();
return false;
}
function validateForm() {

var x= gel("ritm").value;
var y= gel("user").value;
if (x== "" ||y=="") {
alert("Please provide data to submit the dialog.");
return false;
}
return true;
}

Ok and Cancel button dont work as expected.

1 ACCEPTED SOLUTION

Adding this in HTML made it work

<input type="hidden" id="cancelled" name="cancelled" value="false"/>

View solution in original post

5 REPLIES 5

21pa1a6140
Tera Contributor

<g:dialog_buttons_ok_cancel ok="return validateForm()" cancel ="return OnCancel"/>
In the above line OnCancel it should be a function so mention like OnCancel()