Cannot perform .change method on horizontal radio buttons
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?
//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?
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.)
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.)
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
-
- Information
-
Who is online
Users browsing this forum: No registered users and 29 guests