hunt
October 30, 2009, 10:19am
1
<% form_tag :action => “login”, :html_options => {:onClick => “return
validate_form(this)”} do %>
Login: <%= text_field_tag :name %>
Password: <%= password_field_tag :password %>
<%= submit_tag “SignIn” %>
<% end %>
<%= link_to ‘SignUp’, :action => ‘signup’ %>
<%= link_to ‘Forgot Password’, :action => ‘forgot_password’ %>
I wrote the above syntx for validation…using javascript the validation
is not happening.
The page source is below:
<form
action="/bloglogin?html_options%5BonClick%5D=return+validate_form%28this%29"
method=“post”>
Login:
Password:
hunt
October 30, 2009, 10:28am
2
On Oct 30, 9:19 am, HUNT HUNT [email protected]
wrote:
is not happening.
form_for understands what you mean when you do :html_options => …,
but form_tag expects you to pass 2 option hashes: the first containing
routing options, the second containing html options. Also, do you
really want onClick rather than onSubmit ?
Fred
hunt
October 30, 2009, 10:48am
3
Thanks Fred for your reply,
actually the problem is
Using form tag I made a login form as discussed above. For client side
validation
I use Javascript.
<% form_tag :action => “login”, onClick => ‘return
validation_form(this)’ %>
<% submit_tag ‘save’%>
This is not working means client side validation is not performed.
hunt
October 30, 2009, 11:29am
4
Hi
Try this
<% form_tag({:action => “login”}, {:onclick => “return
validate_form(this)”}) do %>
Sijo K George