Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Submit Errors


Message #1 by "Chris Thompson" <cthompson@n...> on Mon, 20 May 2002 13:35:19 -0600
Try this:

1.    change the tag that calls the function to onSubmit='return
CheckSubmit()'
2.    Replace CheckSubmit = false with the statement "return false"

I hope it works,

Majid Qazi



----- Original Message -----
From: "Chris Thompson" <cthompson@n...>
To: "JavaScript HowTo" <javascript_howto@p...>
Sent: Monday, May 20, 2002 3:35 PM
Subject: [javascript_howto] Submit Errors



I know this is more vbscript versus javascript, but if anyone can help,
I'd appreciate it.

I have a form and want to test dome fields before I submit it.  I have s
function that is called from the 'OnSUBMIT' parameter of the FORM tag.
It calls the function correctly, but I am trying to get it to stop the
form processing.  Here is some of my code:

<SCRIPT LANGUAGE='VBSCRIPT'>
Function CheckSubmit()
msgbox "HI"
CheckSubmit = false
End Function
</SCRIPT>

<FORM ACTION='processaddmain.asp' METHOD=POST ONSUBMIT='CheckSubmit()'>

...

</FORM>

Anyone have any ideas as to why the 'CheckSubmit = false' is not
working?  I have also tried 'return false' in place of it, but that
gives me an error.  When I hit the submit button, it shows the msgbos,
then forwards to the next page.  I need it to stop. Any help would be
greaty appreciated.

Thanks in advance,

Chris


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20


  Return to Index