troubleshooting Question

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

Avatar of David Megnin
David MegninFlag for United States of America asked on
JavaScriptASP.NET
6 Comments1 Solution99 ViewsLast Modified:
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

ASKER CERTIFIED SOLUTION
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 6 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 6 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004