Submitting via Forms 
Author Message
 Submitting via Forms

I have a form with action & method & OnSubmit with a submit button.

I am using javascript to validate the various entries and
then if their valid I return(true) or return(false)

and what happens is that the form still jumps to Form.Action.

Anyone can clarify how to make this work?

Thanks in advance :-)



Fri, 02 May 2003 03:00:00 GMT  
 Submitting via Forms

I believe you have to do something like this

<form name="frmTest" method="post" action="default.asp" onsubmit="return
YourFunction();">
...
</form>

Notice the "return".

Or you can do it this way
document.frmTest.onsubmit = YourFunction;

If above codes don't work, you have to trap onclick event on the Submit
button.

Kur


Quote:
> I have a form with action & method & OnSubmit with a submit button.

> I am using javascript to validate the various entries and
> then if their valid I return(true) or return(false)

> and what happens is that the form still jumps to Form.Action.

> Anyone can clarify how to make this work?

> Thanks in advance :-)



Fri, 02 May 2003 03:00:00 GMT  
 Submitting via Forms

Hi

There is no code so i am guessing there is a error
in the validation function, like a misspelled field name
for example. ( case sensitive )

You set it up like so?

<form onsubmit="return vForm( this )">
<input type="text" name="myField">
</form>

function vForm( f ){
 if( f.myField.value == "" )
  {
   alert("bla bla");
   f.myField.focus();
   return false;
   }
return true;

Quote:
}

--
Best Regards
  Vidar Petursson
 ==============================
   Microsoft Internet, Client, SDK MVP
 ==============================
 http://www.icysoft.com
 http://www.dna.is



 ==============================
  No matter where you go there you are
 ==============================


Quote:
> I have a form with action & method & OnSubmit with a submit button.

> I am using javascript to validate the various entries and
> then if their valid I return(true) or return(false)

> and what happens is that the form still jumps to Form.Action.

> Anyone can clarify how to make this work?

> Thanks in advance :-)



Fri, 02 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Submitting a form via vbscript

2. Submitting a form via VBScript

3. Submitting a form via vbscript

4. jumping to a web page via form submit

5. SUBMIT form with 3 different submit buttons - error

6. form submits hrefs images and submit buttons

7. Submitting Form WITHOUT Submit Button

8. Form wont submit using javascript:submit()

9. form submit using different submit buttons

10. Submitting form without submit button...

11. What fires the submit action of a form without a submit button

12. Submitting Form WITHOUT a Submit Button

 

 
Powered by phpBB® Forum Software