function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

On Sumbit of Save JavaScript Validation With AJAX server side data. URGENT



I having VF page same as view on lead.  



1. a field(View Name) should not allowed duplicate name.

2. if we enter the view name then directly(poiter should be in view name input field) click on save button(consider submit).


Now My code is like.

1.onclick js function on save button trying to call <apex:actionFunction>  ajax js function to verify the view name existence. 

2. But Javascript call the  apex:actionFunction ajax, with out waiting till the response. it follows the statements and trying to submit the form.



Ex.<input type="submit" onclick="jsValidate()">function jsValidate(){alert('1');AjaxCheck(document.getElementById('viewname').value);alert('2');//the above function called. with out getting response. returned the function so form was sumbitted.}



But in normal ajax in JSP can wait till getting the response.