Any chance of Auto click Ok (alert) for catalogs client script

String
Kilo Sage

Hi Team ,

Am using the below code in catalogs client script ,we are showing alert in onchange ,but user should not click Alert OK

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
alert('Please wait');//auto click OK 
var test1 = g_form.getValue('check);
var ga = new GlideAjax('Cus'); // Script include
ga.addParam('sysparm_name', 'gettest'); // Method
ga.addParam('consumable', test1);
ga.getXML(getResponse);
}function getResponse(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('test', answer);
}
 
Please guide me 
7 REPLIES 7

AshishKM
Kilo Patron
Kilo Patron

Hi @String , 

In such case, why prompt [ via alert ] required.

Use the g_form.addInfoMessage();

 

 

-Thanks,
AshishKM 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi @AshishKM thanks for your reply ,below is my actually requirement 

I am implementing an asynchronous Ajax call on the "on change" event for Field A. This call retrieves a value for Field B and saves it. However, in the context of using Fields A and B in MVRS, if a user modifies Field A and immediately clicks the Add button, there may be an issue where Field B does not get saved due to the asynchronous nature of the call.

To address this, I intend to introduce a delay by displaying an alert. This delay allows the asynchronous Ajax call to complete before proceeding. However,  users do not want to click alert(OK)  manually. Instead, the delay should automatically take effect when the user clicks Add button.

Amit Verma
Kilo Patron
Kilo Patron

Hi @String 

 

Can you please explain your requirement in detail ? From the information provided, I am able to understand that you want to restrict the user from pressing Ok button in the alert until you get a response from Script Include.

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

HI @Amit Verma   thanks for your reply ,

I am implementing an asynchronous Ajax call on the "on change" event for Field A. This call retrieves a value for Field B and saves it. However, in the context of using Fields A and B in MVRS, if a user modifies Field A and immediately clicks the Add button, there may be an issue where Field B does not get saved due to the asynchronous nature of the call.

To address this, I intend to introduce a delay by displaying an alert. This delay allows the asynchronous Ajax call to complete before proceeding. However,  users do not want to click alert(OK)  manually. Instead, the delay should automatically take effect when the user clicks Add button.