How do I validate a jQuery datepicker field using the Rails client_side_validations gem?

915 Views Asked by At

I'm trying to get a jQuery datepicker instance to validate with client_side_validations and not having any luck.

Anytime I include this in my model

validates_presence_of :due_date, :message => "Please select the due date"

The form just doesn't submit - no JS error, no log entry from Rails.

When I remove focus from the field without a value I do get the error message, so I know it's working at least a little bit.

Just can't figure out how to get the form submitting.

Thanks.

1

There are 1 best solutions below

0
On

Seems to me CSV is hijacking the form before POST, because it doesn't pass, which makes sense. Do you have a :validate => true on the field itself, and are you using callbacks to generate a message? Because without them, it seems CSV will just reject the POST silently. Also, thinking about it, I've had a similar problem with select boxes and CSV, where no "field_with_errors" can be generated. Also, it's possible that the datepicker JS is conflicting with CSV.