The CreatorCon Call for Content is officially open! Get started here.

How to use Call back function

Supriya25
Tera Guru

Hi All,

Please help me on below issue, kindly share your thoughts and provide some solutions

 

code not working , not sure what was wrong . Please help me

OnSubmit Client script:

 

 

function onSubmit() {
if (g_form.getActionName() == "resolve_incident") 
{

getconfirmation();
function getconfirmation(){
var gm = new GlideModal('confirm_changes');

gm.setTitle('Confirm');

gm.setWidth(400);

gm.render();
 
return false;
}
function userClickedOnConfirmed()
{
gm.destroy();
return true;
}
function userClickedOnChange()
{
gm.destroy();
g_form.addErrorMessage(‘Please make changes work notes’);
g_form.setReadOnly(‘assignment_group’, false); 
return false;
}

if (g_form.getValue('contact_type') == 'email') {
     g_form.addErrorMessage('Contact type should not be "Email"');
       return false;
        }
 if (g_form.getValue('category') == 'hardware') {
     g_form.addErrorMessage('Category should not be "Hardware"');
     return false;
    }

return true;
}

 

 

 

 

UI Page:

 

 

 

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 {
    userClickedOnConfirmed();
}
function destroyWindow() {
    userClickedOnChange();
}

 

 

 

 

1 REPLY 1

ricker
Tera Guru

@Supriya25,

I think the problem is callback functions run asynchronously and do not return the answer in time to stop the onSubmit script.