Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

clientContext.executeQueryAsync returns undefined in Ecmascript

$
0
0

Hi,

Scenario:
Need to allow only 4 booking on a particular date.

Solution Implemented
I am trying to validate a form field by calling PreSaveAction() function. In PreSaveAction() function, using Client Object Model -Ecmascript, I am creating client context of the list and filtering the list with the date selected by the user. I am using 

clientContext.executeQueryAsync(Function.createDelegate(this, function(){ _returnParam= onSuccess();}),Function.createDelegate(this, function(){ _returnParam = onFail();})); where onSuccess() method returns true or false based on the condition of the CAML query.

In case of true condition, first time when I am clicking on Save Button, I get the return value as undefined, If I click again - it gives me correct value of the condition.

Because of the above issue, I need to click twice in order to save item in the list.

Any help is much appreciated !

~Krutika


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>