We help IT Professionals succeed at work.
Get Started

JavaScript not setting ASP.NET RadioButtonList in IE, but works fine in FireFox

megnin
megnin asked
on
93 Views
Last Modified: 2015-12-03
The JavaScript function "selects" the first ListItem in the RadioButtonList radBarrier if the first ListItem in radBarrier is selected, otherwise it unselects it.

* This works fine in FireFox v40.x and IE 11 with Compatibility View on.
** With Compatibility View off in IE 11, the selection works fine but the unselection does not work.  
*** I need to make it work in IE 11 without Compatibility View since the 22 Computers where this is displayed are not running in Compatibility view.  Thanks.  :-)

    // This sets "radBarrier" to YES if "radVeteran" 'Veteran' is selected.  Otherwise should unselect radVeteran.
    function SetHaveDisability(QuestionID)
    {
    	var rad = QuestionID;
    	var rbl = document.getElementById(rad);  //  The whole RadioButtonList Control
    	var rbl_0 = document.getElementById(rad + '_0');  //  "Disabled Veteran"
    	if (rbl_0.checked)
    	{
    		document.getElementById("radBarrier_0").checked = true;
    	} else
    	{
    	    document.getElementById("radBarrier_0").checked = false;
    	}
    }

Open in new window



                        <asp:RadioButtonList ID="radVeteran" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" onclick=" SetHaveDisability(this.id); ">
                            <asp:ListItem Value="Veteran" Text="Disabled Veteran" />
                            <asp:ListItem Value="Dependant" Text="Eligible Spouse of a Veteran" />
                            <asp:ListItem Value="Care Giver" Text="Care Giver of an ill, injured, or disabled Veteran" />
                            <asp:ListItem Value="Neither" Text="None of those." />
                        </asp:RadioButtonList>

Open in new window


                    <asp:RadioButtonList ID="radBarrier" runat="server" RepeatDirection="Horizontal"
                        onclick="ShowHideBarrier(this.id);" RepeatLayout="Flow">
                        <asp:ListItem Value="Yes" Text="Yes" />
                        <asp:ListItem Value="No" Text="No" />
                        <asp:ListItem Value="DA" Text="N/A" />
                    </asp:RadioButtonList>

Open in new window

Comment
Watch Question
Fixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE