...

View Full Version : Need help to solve a form / table problem



bigkga
08-03-2008, 10:58 PM
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.


<!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>

ninnypants
08-04-2008, 05:35 AM
I don't understand exactly what you want

bigkga
08-04-2008, 06:48 AM
What I want to do is have Friend and an input box. Then have a second friend with a input box

Corwin
08-04-2008, 07:39 PM
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 ):


<!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"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum