Christoph wrote:
I have set up the onclick event of an href so that it submits a form
and returns false.
Wrong approach.
I'm returning false to prevent the browser from actually going to the page.
Why should it? You are canceling the click event of the link, thereby
preventing its default action, which is to navigate to the resource its
`href' attribute designates.
However, because I have the form submission as part of the onclick event,
it seems like I'm not being successful in preventing that.
Yes, your approach is wrong. When the form is submitted through your
event listener, navigation to another resource has already taken place.
Is there some way I can make it so that the browser doesn't go to the
page?
Use the correct approach: a submit button (input[type="submit"] or
input[type="image"]) and the `onsubmit' event handler of the `form'
element to which you return `false' when the form should not be
submitted. You will have to test server-side anyway.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>