Jump to content
Larry Ullman's Book Forums

Chapter 3


Recommended Posts

I'm just getting started and I realize that submitting a form to a PHP script for processing will not be preempted by Javascript code if there are errors in that code. What causes the Javascript, when coded properly, to intercept a form submission before it gets sent to the server? Also, can anyone recommend a good instructional video for Firebug training?

Link to comment
Share on other sites

Either returning false (or a value that loosely evaluates to false) or executing the preventDefault method of the Event object in the function referenced by the corresponding onsubmit event handler will cause JS to suppress the standard submission of the form.

 

Something important to note is that if an onsubmit event handler is set up for a form, JS will always intercept the form submission (i.e., be executed before the form is submitted), but only when the above action is taken is the form submission to a PHP script, etc. actually suppressed and not performed.

 

As for FireBug, beyond searching from Google and YouTube, I don't know of any particular tutorials.

More than anything, I'd just play with FireBug, and when there's something in particular you don't understand, I'd Google that.

Link to comment
Share on other sites

 Share

×
×
  • Create New...