I am performing two validations on the client side on the samve event. I have defined my validations as shown below
btnSearch.Attributes['OnClick'] = 'javascript:return prepareSave(); return prepareSearch();'
Pseudo code for
prepareSave(): { if (bPendingchanges) { return confirm('Need to save pending changes first, click OK and loose changes or cancel to save them first') } else {return true} }
Pseudo code for
prepareSearch(): { if (bNoSearchText) { alert('Please specify search criteria before proceeding') return false; } else {return true;} }
When bPendingchanges=false, I never get the second validation running. Anyone who can quickly spot what I have overlooked here? Please?
Your second
returnstatement will never be reached. Execution stops afterjavascript:return prepareSave().Looks like you want to return true if both functions return true – therefore, do: