INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Radio button usage in struts

Radio button usage in struts

(OP)
I am trying to develop a web page.In the webpage, i have two radio button. I need to make visible some text fields and labels when one radio button is selected and make other fields invisible. Here is what i have coded

   
    <tr>
      <td width="10%"> </td>
        <td width="10%"  colspan="2" align="center">
               <html:radio property="regradio"  VALUE="viamob"/>
             Register via mobile number</td>
    </tr>
    <tr>
        <td width="10%" colspan="2" align="center">
           <html:radio property="regradio" VALUE="viaAA" />
            Register via AA System number </td>
    </tr>
    
    <tr>
<tr>
       <td width="10%"> </td>  <td width="10%"><font face="Verdana" size="2"><bean:message key="label.login.username" /></font></td>
        <td width="10%">
                <html:text property='newusername'  style="display" /></td>
        <td width="10%"><font face="Verdana" size="2"><bean:message key="label.login.username"/></font></td>
        <td width="10%">
           <html:text property='newusername'  style="display" /></td>        
   </tr>

    <tr>
       <td width="10%"> </td>  <td width="10%"><font face="Verdana" size="2"><bean:message key="label.register.mobileno"/></font></td>
        <td width="10%">
                <html:text property='newmobno' /></td>
        <td width="10%"><font face="Verdana" size="2"><bean:message key="label.register.emailid"/></font></td>
        <td width="10%">
           <html:text property='emailId' /></td>        
   </tr>
<tr>
    
        <html:button property='go' value="Go" onClick="javascript:fnCheck(this.form)"/>
    </tr>



Here is the script part.

<Script language='Javascript'>  
  function fnCheck(frm)
    {
      if(frm.regradio.value=="viaAA")
      {
         frm.newusername.style.display="none";
      }
       if(frm.regradio.value=="viamob")
      {
         frm.newusername.style.display="block";
      }
  }
</script>

But no field is getting visible/invisible when the selection of radio button is different. Please help. I have searched in net , but didnt yield any result

RE: Radio button usage in struts

This is a pure Javascript question, you shouldp post in in the Javascript forum.

Anyway, you're invoking the javascript code when pressing the button, but not when clicking the readiobuttons

Cheers,
Dian

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close