Form validation with Javascript does not work


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 =>,
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

I expect the Form not to be posted if the validation fails (false is

Whats the correct way to do this?

Thank you


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs