I want to intercept the submit event for field validation to cancel this
action if validation failes. I tried to script using the submit method and
also use the FireEvent("OnSubmit") method but neither option submited the
form. Is there another way to do this?

Re: intercepting the submit event by Mark

Mark
Tue Apr 05 12:36:01 CDT 2005

That's a client-side question that would be better asked on a client-side
group. However:

<form name="myform" action="myaction.asp" onsubmit="return
validate_form(this);"

Then add a script function to check each field

function validate_form(theForm)
{
//if a validation fails then return "false"

//first and last names are required
if( trim( theForm.fname.value ).length &lt; 1 )
{
alert( "first name is required" );
theForm.fname.focus();
return( false );
}
if( trim( theForm.lname.value ).length &lt; 1 )
{
alert( "last name is required" );
theForm.lname.focus();
return( false );
}

return( true );

}

--
--Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com

"scott cooper" <scott.cooper@charter.net> wrote in message
news:O$shbQgOFHA.3156@TK2MSFTNGP15.phx.gbl...
>I want to intercept the submit event for field validation to cancel this
>action if validation failes. I tried to script using the submit method and
>also use the FireEvent("OnSubmit") method but neither option submited the
>form. Is there another way to do this?
>



Re: intercepting the submit event by Curt_C

Curt_C
Tue Apr 05 13:41:05 CDT 2005

easiest I know of is dont use a SUBMIT button.
Use a standard one. In the onClick do your stuff then call a
yourForm.submit();


--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"scott cooper" <scott.cooper@charter.net> wrote in message
news:O$shbQgOFHA.3156@TK2MSFTNGP15.phx.gbl...
>I want to intercept the submit event for field validation to cancel this
>action if validation failes. I tried to script using the submit method and
>also use the FireEvent("OnSubmit") method but neither option submited the
>form. Is there another way to do this?
>