I am new to rails.I want to call a javascript function when click the submit button.I used submit_tag , but the function did not get triggered.I want some thing like the followi
You can try
<%= submit_tag , :onclick => "return validateform()" %>
OR
You can Use button_to_function
<%= button_to_function "Greeting", "validateform()" %>
And in your Javascript function, if all the validations pass, submit the form.