Gah
Posted: Fri 23 May, 2008 | Author: Lyle | Filed under: D4D™, Geeky, Work-related |1 Comment »Why is it always the simple stuff that never bastard well works?
All I want to do is have a drop-down box that submits itself to a form when it changes. I’ve been trying to use all variants of
document.forms.submit()
(And document.form.submit() and document.form[‘form_name’].submit() , and document.forms[‘form_name’].submit and so on and so on)
And does it work? Does it shit. Ah well, I’ll figure it out next week.
Probably.
I haven’t test it, but I have a feeling that
document.getElementById('form_id').submit()
should work. (I take it it’s an X?HTML document rather than XML)You could getElementsByTagName(‘form’) provided it’s the only form in the page (or you could otherwise identify it in the array that would be returned).
I think the reason that document.forms isn’t helping is because it’s indexed numberically. Perhaps
document.forms[0].submit()
will also do what you’re after.