How to validate before onSubmit in Mobile/Service PortalIssue This article is documenting how we can achieve the following: Validate input in a client script asynchronously.Prevent the form submit until the input is valid.Submit the form when the input has been validated. How did it use to work? In a nutshell, many platform Ajax requests used getXMLWait().getXMLWait() would make a synchronous request to the server and cause script execution to wait until the server responded. Using ajax in an onSubmit script was as easy as: Executing the requestValidating the responseReturning true or false Validate before onSubmit in Mobile/Service Portal Since all framework Ajax requests are asynchronous you will need to use a callback like in this onSubmit script: function onSubmit() { if (g_scratchpad.isFormValid) return true; var actionName = g_form.getActionName(); doAsyncTask(function() { g_scratchpad.isFormValid = true; g_form.submit(actionName); }); return false;}