That was perfect, thanks!
On Feb 7, 2:50 pm, Ken Snyder <[EMAIL PROTECTED]> wrote:
> Matt Alexander wrote:
> > I have the following code that I'm using to validate the form:
>
> > Event.observe('form', 'submit', function () {
> > return (
> > check_first_name() && check_last_name() &&
> > check_username() && check_password() && check_password_confirm()
> > );
> > });
>
> > How do stop the form from submitting if I return false?
>
> When attaching events via the DOM instead of inline, you need to stop
> events from propagating. Try Event.stop():
>
> Event.observe('form', 'submit', function (evt) {
> if ( !(check_first_name() &&
> check_last_name() &&
> check_username() &&
> check_password() &&
> check_password_confirm()) {
> Event.stop(evt);
> }
> }.bindAsEventListener()
>
> });
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---