Home > javascript validation, presaveaction, SharePoint > Client Side Javascript validation in SharePoint

Client Side Javascript validation in SharePoint


What do you do for performing validations on SharePoint NewForm.aspx and EditForm.aspx??

Write event handlers….That is the common answer we get….But that requires custom code and runs after the form has been submitted to the server.

There is a way by which you can  add javascript validation using the PreSaveAction().



Implement PreSaveAction() function in javascript. This function is called  on client side when “OK” button is clicked, before posting the page to the server.


function PreSaveAction()
{

//implement your validation logic


return true;//Sucess,page will be posted back 


//OR

return false; //Failure,Cancel the save
}


Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: