Welcome to WebmasterWorld Guest from 23.20.241.155

Forum Moderators: open

Message Too Old, No Replies

Form value from multiple selections

     
1:14 pm on Jun 21, 2007 (gmt 0)

10+ Year Member



Hi,

I'm looking for an example of a form that has this particular type of function.

A 'information' box that is populated from 2 drop down menus. The first one to select a 'topic' and the second one to select a 'country'.

So the user would select 'sports' and 'uk' form the 2 menus and press a button to populate the 'information' box.

And repeat the process any number of times.

I need to see something along these lines working on a site so I can prove to someone that it can be done. But haven't had luck finding anything like it.

Thanks,

Lawrence

1:41 pm on Jun 21, 2007 (gmt 0)

10+ Year Member



Easy enough;
<script type="text/javascript">
function doIt(){
var temp01 = document.getElementById('lstTest1')[document.getElementById('lstTest1').selectedIndex].value;
var temp02 = document.getElementById('lstTest2')[document.getElementById('lstTest2').selectedIndex].value;

document.getElementById('txtArea').value = temp01 + ' ' + temp02
}
</script>

<form>
<p>
<select name="lstTest1" id="lstTest1">
<option value="something">something</option>
<option value="other">other</option>
</select>
</p>

<p>
<select name="lstTest2" id="lstTest2">
<option value="red">red</option>
<option value="green">green</option>
<option value="blue">blue</option>
</select>
</p>

<p><input type="button" value="populate" onclick="doIt();"></p>

<p><textarea name="txtArea" id="txtArea" rows="5" cols="20"></textarea></p>
</form>

2:05 pm on Jun 21, 2007 (gmt 0)

10+ Year Member



Damn, I wish I could do that just as easily.

Thanks.

Loz

 

Featured Threads

Hot Threads This Week

Hot Threads This Month