Page 1 of 1

Can you use a "click" or "onclick" handler on SharePoint fields?

Posted: 13 Jan 2015
by Jdubs
When I add some code to perform an action for "onclick," nothing happens.


In my browser debugger, it says "Object doesn't support property or method 'click'


Is there a way to make this work?


I'm using --> fd.field('fieldname').click(function() {

//insert code here;

});

Re: Can you use a "click" or "onclick" handler on SharePoint fields?

Posted: 14 Jan 2015
by Dmitry Kozlov
Sure, please, try the code below:

Code: Select all

fd.field('fieldname').control()._el().find('input').click(function(){
	// your code here
});

Re: Can you use a "click" or "onclick" handler on SharePoint fields?

Posted: 14 Jan 2015
by Jdubs
Thanks Dmitry! That works perfectly :)

Any idea why that works and fd.field('fieldname').click(function() doesn't work?

Only reason I ask is so that I can understand the Forms Designer framework a little better so that I don't have to bug you on questions like these in the future.


Thanks again!

Re: Can you use a "click" or "onclick" handler on SharePoint fields?

Posted: 15 Jan 2015
by Dmitry Kozlov
Hi,

fd.field('fieldname') returns Field object that doesn't contain click method. But you can retrieve jquery-object with the help of control()._el() method and find a particular html-element.

Re: Can you use a "click" or "onclick" handler on SharePoint fields?

Posted: 26 Apr 2015
by Bryan
Hi, may i know what is the 'fieldname' and 'input' stand for?

Re: Can you use a "click" or "onclick" handler on SharePoint fields?

Posted: 27 Apr 2015
by Dmitry Kozlov
'fieldname' is an internal name of a SharePoint column.

'input' is an html-element that is rendered by the field.

Please, find more info in our documentation:
http://spform.com/documentation/js/field

And the blog:
http://spform.com/office-365/cond ... ynamically