Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Need help to solve a form / table problem

    This is what I have done. Now my question is that I have the friend one working but cannot get a repeat with another question which has another question and has a second box that needs to come up. How do i achieve this.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
    
    function SelectCng(sel,id){
     document.getElementById(id).style.display=sel.selectedIndex==3?'':'none';
    }
    //-->
    </script></head>
    
    <body>
    <form>
    <table border="1">
     <tr>
      <td>Your Name </td><td><input type="text" name="Name" /></td></tr>
     <tr>
      <td>Email Address</td><td><input type="text" name="Email" /></td></tr>
     <tr>
      <td>First Time Here?</td><td><select size="1" name="First">
       <option value="No">No</option>
       <option value="Yes">Yes</option>
       </select>
      </td>
     </tr>
     <tr>
      <td>
       How did you find us?
      </td>
      <td>
       <select size="1" name="Found_by" onchange="SelectCng(this,'Friend');" >
       <option value="Newspaper">Newspaper</option>
       <option value="Search Engine">Search Engine</option>
       <option value="Flyer">Flyer</option>
       <option value="Friend">Friend</option>
       </select>
       </td>
      </tr>
     <tr id="Friend" style="display:none;" >
      <td>
       Friends Name
      </td>
      <td>
       <input name="FriendName">
      </td>
     </tr>
    </form>
    </table>
    
    </body>
    
    </html>
    Last edited by Kor; 08-04-2008 at 02:52 PM. Reason: wrap the code [code][/code], please

  • #2
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    I don't understand exactly what you want

  • #3
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What I want to do is have Friend and an input box. Then have a second friend with a input box

  • #4
    New Coder
    Join Date
    Jul 2008
    Posts
    32
    Thanks
    3
    Thanked 1 Time in 1 Post
    if i understand what you are saying, you have the first dropdown working, and if freind is selected it pulls up an input box so you pay type the freind's name.

    what you now want is to created a second question with an dropdown, and when the proper item is selected you want a new input box to show up liek the friend one did.

    if that is the case, then here is what worked for me ( IE7 ):

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
     
    <html>
     
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
     
    function SelectCng(sel,id){
     document.getElementById(id).style.display=sel.selectedIndex==3?'':'none';
    }
    //-->
    </script></head>
     
    <body>
    <form>
    <table border="1">
     <tr>
      <td>Your Name </td><td><input type="text" name="Name" /></td></tr>
     <tr>
      <td>Email Address</td><td><input type="text" name="Email" /></td></tr>
     <tr>
      <td>First Time Here?</td><td><select size="1" name="First">
       <option value="No">No</option>
       <option value="Yes">Yes</option>
       </select>
      </td>
     </tr>
     <tr>
      <td>
       How did you find us?
      </td>
      <td>
       <select size="1" name="Found_by" onchange="SelectCng(this,'Friend');" >
       <option value="Newspaper">Newspaper</option>
       <option value="Search Engine">Search Engine</option>
       <option value="Flyer">Flyer</option>
       <option value="Friend">Friend</option>
       </select>
       </td>
      </tr>
     <tr id="Friend" style="display:none;" >
      <td>
       Friends Name
      </td>
      <td>
       <input name="FriendName" />
      </td>
     </tr>
     <tr>
      <td>
       How did you find us?
      </td>
      <td>
       <select size="1" name="Found_by" onchange="SelectCng(this,'bli');" >
       <option value="heh">heh</option>
       <option value="bla">bla</option>
       <option value="blo">blo</option>
       <option value="bli">bli</option>
       </select>
       </td>
      </tr>
     <tr id="bli" style="display:none;" >
      <td>
       Friends Name
      </td>
      <td>
       <input name="FriendName" />
      </td>
     </tr>
    </form>
    </table>
     
    </body>
     
    </html>
    you need to have all 3 of the red highlighted text be the same as each other, but be diferent from your first dropdown/input combo for it to work. . . in this case i changed "freind" to "bli"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •