Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to enable/disabled asp;textbox upon selected value of RadiobuttonList

Status
Not open for further replies.

Velocityman

Programmer
Mar 25, 2014
4
0
0
US
Here is the info need. I wanted to disabled the asp textbox when radiobutton list is set to "No" and enabled when set to "Yes". It doees not toggle. Any help will be greatly appreciated. Thanks!!

javascript:
function SetMemoSectionOpen()
{
var txt
var rgrp = document.getElementsByName("<%=RadioButtonList5.ClientID%>");
for(var i = 0; i < rgrp.length; i++)
{
if(rgrp.type == 'radio')
{
if(rgrp.checked == true)
{ txt= rgrp.value;
}
}
}
alert(txt)
if (txt = "No") {
document.getElementById('tbRevMaxDesc').disabled = true;
}

else
if (txt = "Yes")
{
document.getElementById('tbRevMaxDesc').disabled = false;
}
}




.aspx page elements:

RadioButtonList:
<asp:RadioButtonList ID="RadioButtonList5" runat="server" onclick="SetMemoSectionOpen();"
TabIndex="67" Width="500" style="margin-left: 66px">
<asp:ListItem Value="Yes">
Yes
</asp:ListItem>
<asp:ListItem Value="No">
No
</asp:ListItem>
</asp:RadioButtonList>


Asp TextBox:

<asp:TextBox ID="tbRevMaxDesc" TabIndex="68" runat="server" Width="600" Height="600" MaxLength="1000"
TextMode="MultiLine" OnKeyUp="textCounter(tbRevMaxDesc, this.form.tbRevMaxDescCharCount, 1000);"
OnKeyDown="textCounter (tbRevMaxDesc, this.form.tbRevMaxDescCharCount, 1000);"
BorderStyle="Solid" style="margin-left:0px" BorderWidth="1px"></asp:TextBox>

 
Nevermind. I used the case statement using switch and now it is evaluating appropriately - the toggle function. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top