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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radio button and text field help

Status
Not open for further replies.

Rori

IS-IT--Management
Joined
Mar 10, 2004
Messages
10
I have a form with 6 radio buttons in a set and a text field corresponding to each radio button. I want the users to select a radio button and when thay select a radio button all the text fields will become disabled except for one that is corresponding to that radio button, so that can they can enter data only in that text field....
Any ideas how can I do it code help will be great...
Thanks
 
<form name=myform ...>
<input type=radio name=myradio value=1 onclick=&quot;disablefields(1)&quot;><input type=text name=mytext1><br>
...
</form>

function disablefields(id){
for (i=1 ; i<=6 ; i++){
tf=eval('myform.mytext'+i+';');
tf.disabled=(i==id);
}
return true;
}

I hope this can help you out. Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
I am using strutsin my jsp so my form and fields look like this... I can not define name since it is nested tags....



<html:radio property=&quot;find.search.AppSearchType&quot; value=&quot;APP&quot;/>
<td >Application ID</td>
<td><html:text property=&quot;find.search.appId&quot; size=&quot;20&quot; maxlength=&quot;15&quot; styleClass=&quot;txtregular&quot;/></td>


while my form look like this

<html:form method=&quot;post&quot; action=&quot;/findApplication.do&quot; >

any ideas how can i do in this frame work...
thanks




 
Sorry, but i never worked with jsp before.
Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
I tried it in plian html it says tf undefined .... how can I take care of that...
totally new to js...
tahnks
 
Can someone tell me why this code not working it is giving me error tf undefined....
Thanks


<form name=myform ...>
<input type=radio name=myradio value=1 onclick=&quot;disablefields(1)&quot;><input type=text name=mytext1><br>
...
</form>

function disablefields(id){
for (i=1 ; i<=6 ; i++){
var tf=eval('myform.mytext'+i+';');
tf.disabled=(i==id);
}
return true;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top