Friday, April 20, 2012

Event on Save button click using JQuery in SharePoint Form(New/EditForm.aspx)

Validation on dropdown value in New/EditForm.aspx before submit the Form using JQuery


<script language="javascript" type="text/javascript" src="../../jQuery%20Libraries/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
function PreSaveAction()
{
 if(($("select[title$='Status']").val()=='Select') && ($("select[title$='Status']").is(':visible')))
 {
  alert("Required field: "+ $("select[title$='Status']").attr('title'));
  return false;
 }
return true;
}
</script>
Here PreSaveAction() is the build in function so we need to add our custom code in this function.

2 comments:

  1. Hi,

    I have added a HTML button using Jquery in my default list form(Cannot add using HTML).Now i want to commit changes on that button click.Not able to use __Commit function.

    Do you have any idea about that approach???

    Thanks

    ReplyDelete
  2. But when i try to do this in save click i am assigning a value to one of the filed which is not get saved

    ReplyDelete