On 10 Nov 2007, at 18:32, Mike Dershowitz wrote:
>
> Hi, I have something really weird going on.
>
> In this form header:
>
> <% form_for(:task,:url => tasks_path, :html => { :onsubmit =>
> ''validate_task();'', :id => "new_task" }) do
|f| %>
>
> I call "validate_task" to validate some of the form inputs. The
> javascript returns false when I don''t fill in the task name.
Simple,
> right. What''s weird is that the form submit continues even though
the
> javascript returns false. Why is this?
>
You actually have to say return foo - this isn''t like ruby, ie your
onsubmit should be ''return validate_task();''
Fred> I''ve tried to work around this. If I have the onsubmit return
false,
> the form doesn''t get submitted. But when I have a function call
return
> false, the form still submits through. The validate function is in
> application.js.
>
> Any help you can give would be greatly appreciated!
>
> Mike
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---