PreSaveAction() : Do stuff before form submit

I might be a little late to the party on this one, but I’ve just come across PreSaveAction() for SharePoint forms. This allows you to add a JavaScript function (called PreSaveAction) to a form, and it’ll get called before the form is submitted.

function PreSaveAction() {
	//Manipulate Fields before saving
	//Or perform custom validation
	//There's loads of uses, particularly if also using JQuery.
	return true; //Return false to cancel submit
}

Bizarrely, this has been in SharePoint since SP2007, yet somehow I’ve not come across it before. Clearly, it isn’t as powerful as Display Templates, but that’s a nice feature!

Advertisements
PreSaveAction() : Do stuff before form submit

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s