This is challenging particular when we use it with presaveaction that would expect true or false and ExecuteQueryAsync returns output infuture. PreSaveAction in SharePoint does validation before submitting an item to SharePoint list.
Solution: By using jquery I had added custom OnClick fumction to the existing Save button. The custom function does the validation and once it is completed I had called orginial Save function to complete the saving process.
In below code I am using JSOM ExecuteQueryAsync to fetch status of SharePoint list item field. Based on status of field and I am comparing it other field as part of business validation. During the validation I decide whether to save the item or not. If the item is valid I am calling orginal save function or else just an alert will be displayed to user that there is problem with request. I had used this code in editform.aspx.
Output
No comments:
Post a Comment