Spinal
MB Enthusiast
- Joined
- Sep 14, 2004
- Messages
- 4,806
- Location
- between Uxbridge and the Alps
- Car
- x254, G350, Duster, S320, Mach1, 900ss and a few more
Hello! Does anyone know Javascript? I know I don't!
I'm making a form to edit a users data online. The data for all users is pulled off of the database (Php/MYSQL) and displayed in a SELECT box. But for this example:
What I want to happen is that when the user clicks on (say) Elisa, in the "data" textbox an "e" appears (i.e. the value of that option). Then the user can modify it and click on submit.
My weak attempt at Javascript:
Any pointers?
Thanks, Michele
I'm making a form to edit a users data online. The data for all users is pulled off of the database (Php/MYSQL) and displayed in a SELECT box. But for this example:
Code:
<form name="myFormName action="someProcess.php">
<select name="Name" onclick="this.form.data.value=getData(this);">
<option selected value ="a">Amelie</option>
<option value="b">Betty</option>
<option value="c">Cristine</option>
<option value"d">Denise</option>
<option value="e">Elisa</option>
</select>
<input name="data" type="text" >
<input type="submit" name="submit">
</form>
What I want to happen is that when the user clicks on (say) Elisa, in the "data" textbox an "e" appears (i.e. the value of that option). Then the user can modify it and click on submit.
My weak attempt at Javascript:
Code:
<script type="text/javascript"
function getData(inputItem)
{ with (inputItem.form){
//update form.data... somehow...
// update form.data(eval(inputItem.value));
}
}
</script>
Any pointers?
Thanks, Michele