showValue help

Hi Guys, Im not very good with Javascript so please excuse my really newbish question, but im having major issues with what im trying to achive.

This is what i’ve got so far as the example

<form name="theform" onSubmit="CheckForm()">
<select name="myOptions" onChange="document.theform2.showValue.value=this.value">
<option value="">Please select an option</option>
<option value="1">I am the first option</option>
<option value="2">I am the second option</option>
<option value="3">I am the third option</option>
<option value="4>I am the fourth option</option>
</select>
</form>

<form name="theform2" onSubmit="CheckForm()">
<input type="text" name="showValue"><br>
</form>

The question is:-

How do i get the form “theform2” to show “I am the first option” and not the actual Value “1” in the text box when i change the drop down on the top form?

I can’t change the value, as thats also doing something else, Is there a way I can tell it to showValue for the visual part of the <option> or maybe use a value2=“I am the first option” if thats possible?

I hope you can all understand what im trying to achive here.

Kindest Regards
Dan.

Thats siteguru, but Figured it with help from a friend, Using the Jquery Lib’s

For anyone else who needs such thing you could do it this way that I have.

<html>
<head>
<script src="jquery.js" ></script>
<script>
$(document).ready(function() {
        $('#c').submit(function() {
                somevar = $('#optionthingy :selected').text();
                $("#show").val(somevar );
                return false;
        });
});
</script>
</head>
<body>
<form name="theform" id="c" method="post" >
<select id="optionthingy" name="myOptions">
<option value="">Please select an option</option>
<option value="1">I am the first option</option>
<option value="2">I am the second option</option>
<option value="3">I am the third option</option>
<option value="4">I am the fourth option</option>
</select>
<input type="submit" name="submit" />
</form>

<form name="theform2">
<input type="text" id="show" name="showValue"><br>
</form>
</body>
</html>

Your search term for today is selectedIndex. :slight_smile:

Do I take you just want solutions, and not to learn WHY it works?