Hello,
i try to validate with JS if a Formfield has been filled with data.
Usually I use “onsubmit()” in the form.
My Code is
<%= start_form_tag :action => ‘update’, :id => @person.id,
“onsubmit”=>“return
isDateSet(document.forms[0].elements[‘fieldname’].value)”; %>
The JS-function returns false if length of fieldvalue < 1. So far
everything works fine.
But: the message does not appear, the Form is posted although it should
not.
I expect the Form not to be posted if the validation fails (false is
returned).
Whats the correct way to do this?
Thank you
Thorsten