| Author |
Control an Input box from a Drop Down box
|
|
|
| Please forgive me if this is not the right place for this question
All(!) Iwant to do is have a form with a Drop Down box and an Input
box.. and when the forms "Submit" button is clicked both values should
be sent to the server.. so far so good (I'm ok with forms and
"Submit").. but when the user selects a new value from the drop down
the input box should be updated
in 'proper' VB this would nearly be
DropDown.OnClick
(
Input_Box.Value = DropDown.Value
)
So I'm looking for any VB examples !!!
| |
| McKirahan 2004-03-28, 9:57 pm |
| "Peb" <peter.bailey@innogy.com> wrote in message
news:2d0484f3.0403101247.1d9667f5@posting.google.com...
> Please forgive me if this is not the right place for this question
>
> All(!) Iwant to do is have a form with a Drop Down box and an Input
> box.. and when the forms "Submit" button is clicked both values should
> be sent to the server.. so far so good (I'm ok with forms and
> "Submit").. but when the user selects a new value from the drop down
> the input box should be updated
>
> in 'proper' VB this would nearly be
>
> DropDown.OnClick
> (
>
> Input_Box.Value = DropDown.Value
>
>
> )
>
> So I'm looking for any VB examples !!!
Do you mean "InputBox" or "text box"?
The following uses JavaScript to do what I think you want:
<html>
<head>
<title>text_box.htm</title>
<script type="text/javascript">
function picker() {
var form = document.form1;
form.picked.value = form.pick.options[form.pick.selectedIndex].value;
}
</script>
</head>
<body>
<form name="form1">
<select name="pick" onchange="picker()">
<option value="1">One
<option value="2">Two
<option value="3">Three
</select>
<input type="text" name="picked">
</form>
</body>
</html>
| |
| Net Mongrel 2004-03-28, 9:57 pm |
| Peb wrote:
> Please forgive me if this is not the right place for this question
news:comp.lang.javascript
> All(!) Iwant to do is have a form with a Drop Down box and an Input
> box.. and when the forms "Submit" button is clicked both values should
> be sent to the server.. so far so good (I'm ok with forms and
> "Submit").. but when the user selects a new value from the drop down
> the input box should be updated
Why do you want that? The selected value from the drop-down will also be
passed to the server.
Consider also, the very likely (and becoming more likely) scenario that your
visitor will have all client script disabled in their browser.
--
Net
| |
|
| "McKirahan" <News@McKirahan.com> wrote in message news:<JzM3c.681
>
> The following uses JavaScript to do what I think you want:
>
Great that was just was I was looking for.. thanks very much
|
|
|
|