Connecting Tech Pros Worldwide Forums | Help | Site Map

Submit Form

Matthew256
Guest
 
Posts: n/a
#1: Oct 30 '06
How can I submit this form on criteriaBlur?

<form>
<input type="text" name="criteria1" onblur="criteriaBlur(this);">
</form>

function criteriaBlur( obj ) {
if( ... ) {
//submit form
}
}


Tim Slattery
Guest
 
Posts: n/a
#2: Oct 30 '06

re: Submit Form


"Matthew256" <PRESENT321@gmail.comwrote:
Quote:
>How can I submit this form on criteriaBlur?
>
><form>
><input type="text" name="criteria1" onblur="criteriaBlur(this);">
></form>
>
>function criteriaBlur( obj ) {
>if( ... ) {
>//submit form
>}
>}

<form id="myform">
<input type="text" name="criteria1" onblur="criteriaBlur(this);">
</form>

function criteriaBlur( obj )
{
document.getElementById("myform").submit();
}

--
Tim Slattery
Slattery_T@bls.gov
Randy Webb
Guest
 
Posts: n/a
#3: Oct 30 '06

re: Submit Form


Matthew256 said the following on 10/30/2006 11:56 AM:
Quote:
How can I submit this form on criteriaBlur?
>
<form>
<input type="text" name="criteria1" onblur="criteriaBlur(this);">
</form>
>
function criteriaBlur( obj ) {
if( ... ) {
//submit form
}
}
Give your form an ID and then submit() the form:

document.forms['formID'].submit();

But, for the record, that is a dumb way to submit a form.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Matthew256
Guest
 
Posts: n/a
#4: Oct 30 '06

re: Submit Form


Oh bother. I was hoping there was a cleaner way.
Thanks for your help!

On Oct 30, 12:23 pm, Tim Slattery <Slatter...@bls.govwrote:
Quote:
"Matthew256" <PRESENT...@gmail.comwrote:
Quote:
How can I submit this form on criteriaBlur?
>
Quote:
<form>
<input type="text" name="criteria1" onblur="criteriaBlur(this);">
</form>
>
Quote:
function criteriaBlur( obj ) {
if( ... ) {
//submit form
}
}<form id="myform">
<input type="text" name="criteria1" onblur="criteriaBlur(this);">
</form>
>
function criteriaBlur( obj )
{
document.getElementById("myform").submit();
>
}--
Tim Slattery
Slatter...@bls.gov
Randy Webb
Guest
 
Posts: n/a
#5: Oct 30 '06

re: Submit Form


Matthew256 said the following on 10/30/2006 12:48 PM:

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Quote:
Oh bother. I was hoping there was a cleaner way.
"Cleaner way"? Sure:

obj.form.submit();
Quote:
Thanks for your help!
Thanks for not top-posting next time.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Closed Thread