prevent form submission?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 04:25 AM
i am writing a client script which will give a alert when same email id is present already in the table. But when I am submitting the form it is allowing the user to submit.
I want to prevent the submission of form if same email id is present?
I am writing a client script and script include for that which is client callable. I am checking the existing email ID with the help of gr.addQuery() in script include.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 04:46 AM
Is it a onsubmit client script? Are you using getXML for glideAjax? If so, replace it with getXMLWait().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 04:48 AM
Hi Saurabh,
can you please share your Client script here, so that we can debug what's going on
Thanks & Regards
Govind Kumar Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 04:52 AM
this is the client scriptI am using-
function onSubmit() {
//Type appropriate comment here, and begin script below
var emailid = g_form.getValue('email_id');
var ga = new GlideAjax('global.HelloWorld');
ga.addParam('sysparm_name','helloWorld');
ga.addParam('sysparm_useremail',emailid);
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer == 'true')
{
alert('Email already exists');
}
return false;
}
}
and this is the script include which is client callable-
var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
helloWorld : function(){
var answer = 'false';
var emailid = this.getParameter('sysparm_useremail');
var gr = new GlideRecord('x_19064_electric_b_user_information');
gr.addQuery('email_id',emailid);
gr.query();
if(gr.next())
{
answer = 'true';
}
return answer;
},
type: 'HelloWorld'
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 04:54 AM
So I guessed it right Remove getXML and replace it with getXMLWait(). and change the code accordingly

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 04:54 AM
Hi Saurabh,
Can you please use getXMLWait and check the output once.