...

View Full Version : submit method ?



angst
12-22-2005, 10:10 PM
hello,
I'm wondering what methods I could use to submit a form,

currently I must hit the submit button, but what I'd like to be able to do it just hit tab when I read the last <select> box on the page, and have the form submit from there, is this possible? and if so, how?

thanks in advance for your time!
-Ken

Mongus
12-23-2005, 01:44 AM
Take a look a the form.submit() function. You could add an onblur handler to your select to call submit. Something like this (untested):
<select name="myselect" onblur="this.form.submit()">
The problem with onblur is that no matter how you left the select it would submit the form. A better way would be to add an onkeydown handler and call submit if the key pressed was tab.

Basscyst
12-23-2005, 02:09 AM
Or



<select name="myselect" onchange="this.form.submit()">


With this though, make sure you have a default selection to change from.

Basscyst

angst
12-23-2005, 04:00 PM
hmm,
ok, only question now is,
I'm already using this:
onChange='Add()'

in the <select>, so how can I use both at once?
like?
<Select name='select' onChange='Add()';onblur='this.form.submit()'>

thanks again for your time!

-Ken

Mongus
12-23-2005, 04:03 PM
The problem with using onchange is the user cannot use the keyboard to make a selection unless they open the drop box first. Most don't know that they can open it from the keyboard.

angst
12-23-2005, 04:08 PM
well, the onChange is for another function on the page,
I still want to use the onBlur for the submit, but not sure how to use both at once.

any ideas?

thanks again for your time!
-ken

Nischumacher
12-23-2005, 04:15 PM
<Select name="select" onchange="Add()" onblur="this.form.submit()">

if you want both on the same event... then simply put this.form.submit() as the last line in your Add() function....

angst
12-23-2005, 04:56 PM
kool,
that did the trick;-)

thanks!
-ken



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum