vendredi 9 janvier 2015

Set value of input field based on previous select field

I have a form which, using javascript needs to set a readonly input field with a value I set based on the value of a select field previously set. The select field is this:-



<select name="colours500" id="colours500">
<option selected="selected">Please Select...</option>
<option value="0.5">1</option>
<option value="0.7">2</option>
<option value="0.9">3</option>
<option value="1.1">4</option>
<option value="{1.3">Full Colour</option>
</select>


and the input following needs to be populated with 1 of 5 arbitrary numbers based on whether the user selected 1-5 in the above select field i.e.


IF select value = 0.5 => PUT value '10' into input field


IF select value = 0.7 => PUT value '20' into input field


etc etc


To complicate this a little further I will need to do this in 5 forms on 1 page (all will have unique field names)


All assistance will be greatly appreciated!


Aucun commentaire:

Enregistrer un commentaire