We can validate ruby on rails form using java script.It is show in bellow example
java script function
function validate()
{
//validation code
if (valid)
return true
else
return false
}
function validate(){
//validate code
if (valid){
return true;
}
else{
return false;
}
}
ruby on rails form
<% form_for(@patient_details,:html=>{:onsubmit=>"return validate();"}) do |f| %>
<%= f.error_messages %>
#form
<%end%>
No comments:
Post a Comment