Set Check-box from button click
Instead of using fd.field(...).value(), use:
Where 'checkbox' is the internal name of the checkbox control and 1 in eq(1) is the index of the checkbox in the checkbox control that you want to select/unselect. click() is effectively the same as clicking the checkbox with your mouse.
Code: Select all
fd.field('checkbox').control()._el().find('tr input').eq(1).click()
This is what I have in the button on click:
fd.field('DTProjectNumberRequested').value('1');
fd.field('DTProjectNumberRequested').control()._el().find('tr input').eq(1).click();
alert('Hello');
The checkbox gets checked, the checkbox's on click event does not fire, the alert does pop up. Thanks again, it's the easy things sometimes.
Hubbaroo
fd.field('DTProjectNumberRequested').value('1');
fd.field('DTProjectNumberRequested').control()._el().find('tr input').eq(1).click();
alert('Hello');
The checkbox gets checked, the checkbox's on click event does not fire, the alert does pop up. Thanks again, it's the easy things sometimes.
Hubbaroo
Having this code in the JS editor:
And this code in the button onclick handler:
Works. I have just tested it on my machine. If it doesn't work for you: -check the InternalName is correct (it's not nesessarily the same as the caption for your checkbox control. check it under 'InternalName' in the property grid in Forms Designer for you control) -check console for any JS errros. If you get exceptions in your code it may stop your handler from attaching for example (F12 -> console to bring up the console, depending on the browser). -if the problem still persists, send us the html of your page to support@spform.com
Code: Select all
fd.field('DTProjectNumberRequested').change(function(){
alert('clicked');
});
Code: Select all
fd.field('DTProjectNumberRequested').control()._el().find('tr input').eq(1).click();
Please use the following code:
(I assumed you were using a multiple checkbox control, not boolean).
Code: Select all
fd.field('DTProjectNumberRequested').control()._el().find('span input').eq(0).click();
-
- Information
-
Who is online
Users browsing this forum: No registered users and 17 guests