3

I have custom list in which there are two mandatory fields, and I want to ask the user if he wants to again enter the new item after one item is created. I searched over the internet and found this link which triggers the click event of the save button. I placed the contnet editor web part in the NewForm.aspx and wrote the code as below:

<script src="/sites/zzz/Style%20Library/jquery.SPServices-0.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){        
     $('input[value=Save]').click(function() {       
        confirm('Do you want to enter the another record?');
      });  
    });  
</script>

But I want to trigger the function after the validations are fired and the item is saved to the list.

I have applied JSLink to one field in the NewForm also, can there be anything done using JSLink?

How do I accomplish this?

2

I have debug code on Office 365 and SharePoint, and have behavior equals.

I see code onclick of the button SAVE: presaveitem

then, try create javascript file and add this method:

function PreSaveItem(){
// add other your codes
if(value == 'confirm'){
  return true; // allow save form...
}

return false; // not allow save form
// use return true; if confirm or return false...
}

this event triggered before on submit form.

and after, try add link Javascript to form or content editor web part.

Hope this help.

Thanks.

Notes: if want validate some fields manually, implements code validation inside of PreSaveAction().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.