Clear Value is not working on client script?

ch_naresh207
Giga Expert

I have validated Single text variable if existing table record is there or not. If is there need to show up alert message and need to clear the value.

 

here alert is working fine , but clear value is not working.

*** once I added g_form.setValue('new_site_url',''); then keep on clearing the variable value , even the record is not there in table:

 

Alert popup is working ,With out 'g_form.setValue('new_site_url','')' is working fine . 

Could you please help me on this.

 

Please fin the below client script and script include --------------

client script:

function onChange(control, oldValue, newValue, isLoading) {

if (isLoading || newValue == '') {

return;

}

var folderd = new GlideAjax("site_url_sharepoint");

folderd.addParam("sysparm_name", "getFolderDetails");

folderd.addParam("sysparm_new_folder_name", g_form.getValue('new_site_url'));

folderd.getXML(ajaxResponse);

function ajaxResponse(serverResponse) {

var answer = serverResponse.responseXML.documentElement.getAttribute("answer");

//alert(answer);
if(answer == 'true')

alert('Existing Site URL is available, please enter the new Site URL name');
g_form.setValue('new_site_url','');

}

}

===============

Script Include:

var site_url_sharepoint = Class.create();

site_url_sharepoint.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getFolderDetails: function(){

var newFolder = new GlideRecord('u_shared_folders');

newFolder.addQuery('u_folder', this.getParameter('sysparm_new_folder_name'));

newFolder.query();

if(newFolder.next())

return true;

},

type: 'site_url_sharepoint'

});

 

10 REPLIES 10

wbrown1
Mega Contributor

Did you get an answer for this? If not try this.

 

g_form.setValue('new_site_url',''); return;