Re: Easy Javascript function too much for me
V <[email protected]> Sat, 17 Dec 2022 01:20:25 -0800 (PST)
| Newsgroups | alt.comp.lang.javascript |
|---|---|
| Message-ID | <[email protected]> |
The answering may be a bit late.
For the help of others too, who may be messing with this, I reply to this still.
The solution would have been a script.
var a = document.getElementById("Aa");
var value = a.value;
var value2=a.options[e.selectedIndex].text;
document.getElementById("Hiddenfield").value="Aaaaaaa"; (Based on the select value)
On Tuesday, December 18, 2007 at 10:32:03 PM UTC+2, Pupkin wrote:
> Hi,
> This is easy for you, but I am dum. Can someone help me out?
> I have a form that has a select field and a hidden field. I need the
> hidden field to update based on the value of the select.
> Like:
> <form name="mydumform" onsubmit="makethiswork">
> <select name="mydumselect">
> <option>A</option>
> <option>B</option>
> <option>C</option>
> <option>D</option>
> <option>E</option>
> <option>F</option>
> <option>G</option>
> </select>
> <input type="hidden" name="dumfield">
> <input type="submit" etc.>
> </form>
> if select = A B C or D, hidden = 1
> if select = E F or G, hidden = 2
> else hidden = 0
>
> I know how these if then statments work, but what I suck at is
> understanding how to phrase it as a function and then stick that
> function into the form.
> Whoever helps me with this may well change the way I understand the
> universe.
> Thanks.