Cannot perform .change method on horizontal radio buttons

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Jdubs
Posts: 73
Joined: Fri Dec 19, 2014

29 Jul 2015

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?

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

30 Jul 2015

I copy-pasted in your code and it works as expected. Are you using correct InternalName values?

Jdubs
Posts: 73
Joined: Fri Dec 19, 2014

30 Jul 2015

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.)

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

31 Jul 2015

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 25 guests