.change(call named function)

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Dan_C
Posts: 63
Joined: Tue Dec 02, 2014

16 Dec 2014

Hi Dmitry,

I'd like for several different fields to call the same function when any of them are changed.

This may relate to my inexperience in all this, but when when I put a previously (outside the change) named function inside the change() handler it seems to break after working once.

I don't have to repeat the same long function inside each change() do I?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

17 Dec 2014

Hi,

Of course, not. You can define a single handler for multiple events this way:

Code: Select all

function OnFieldChanged() {
	// your code here
}

fd.field('Field1').change(OnFieldChanged);
fd.field('Field2').change(OnFieldChanged);

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests