Can you use a "click" or "onclick" handler on SharePoint fields?
Posted by Jdubs - Jan 13 ’15 at 10:47
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;
});
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
Sure, please, try the code below:
fd.field('fieldname').control()._el().find('input').click(function(){ // your code here });
-
JdubsMemberMember for: 8 years 5 months 19 days
[#1]: 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!
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
-
BryanMemberMember for: 8 years 1 month 14 days
Hi, may i know what is the 'fieldname' and 'input' stand for?
-
Dmitry KozlovAdminMember for: 9 years 8 months 16 days
[#4]: '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/fieldAnd the blog:
http://formsdesigner.blogspot.com/2014/07/how-to-conditionally-hide-disable-make.html -
peter0900MemberMember for: 6 months 29 days
When a button is clicked, the on-click event causes a specific functionality to be carried out. This might occur when a user submits a form when you modify certain web page content and other similar events.