Page 1 of 1

Cannot perform .change method on horizontal radio buttons

Posted: 29 Jul 2015
by Jdubs
I'm using the following code to make my Radio buttons horizontal per another thread on here:



//Horizontal Radio Buttons

var rows = fd.field('Action').control()._el().find('table tr td');

fd.field('Action')

.control()

._el()

.find('table > tbody')

.empty()

.append($('<tr />').append(rows));


However, when I use this code, I can no longer perform a .change Method on the field in question:


//Test change method

fd.field('Action').change(function() {

z = fd.field('Action').value();

alert(z);

});

However, when I remove the horizontal code, the change method works as intended. Any way around this?

Re: Cannot perform .change method on horizontal radio buttons

Posted: 30 Jul 2015
by rostislav
I copy-pasted in your code and it works as expected. Are you using correct InternalName values?

Re: Cannot perform .change method on horizontal radio buttons

Posted: 30 Jul 2015
by Jdubs
Yes, the correct internal name is Action (with no spaces/underscores/special characters).

And my code works, just not in conjunction with the code that makes the radio buttons horizontal.



Here's how to reproduce the error:

Create "Choice" SharePoint field, name it whatever (in this case, "Action"), and select either "Checkbox" or "Radio button"
Insert following JavaScript Code:
//Horizontal Radio Buttons

/*var rows = fd.field('Action').control()._el().find('table tr td');

fd.field('Action')

.control()

._el()

.find('table > tbody')

.empty()

.append($('<tr />').append(rows));/*

3. Now insert another code snippet:

//Test change method

fd.field('Action').change(function() {

z = fd.field('Action').value();

alert(z);

});

4. Open Form, and change the value in the "Action" checkbox/radio button.

5. The code does not fire.

6. (If I remove the code listed in Step 2, the code does fire.)

Re: Cannot perform .change method on horizontal radio buttons

Posted: 31 Jul 2015
by rostislav
I've tested all of the code you posted in the first post and it works fine for me. Please send use the html source code of your page to support@spform.com