[thelist] Automatically clicking submit button?
Mark Howells
mark at mountain.ch
Tue Mar 19 11:16:01 CST 2002
> I've got a form that users fill out, process some
> information, then I need to send them onto the next
> step. Unfortunately, there's too much information to
> be passed in the URL (or GET method) so I'm having to
> setup a submit button and POST method.
>
> However, I don't want that user to have to stop and
> click the "continue" button in this case, I'd rather
> just somehow automatically click the button for the
> user. Hopefully they wouldn't even see the page come
> up.
When do you want the form to post itself? When all of the fields are
completed? You could add a Javascript onblur function to all of the fields,
which will fire document.form.submit() if all the fields are filled.
This example will work with text and hidden fields.
<input type="text" name="myField" onblur="sCheck()" />
function checkfields(){
elms=document.myForm.elements;
for(ff=0;ff<elms.length;ff++){
if(elms[ff].value==""){return false;}
}
return true; // only fires if all fields have a value
}
function sCheck(){
if(checkfields){document.myForm.submit();}}
Regards
Mark Howells
<http://www.mark.ac/evl/>
More information about the thelist
mailing list