Closed mledom closed 12 years ago
I'm including both the rails.validations and rails.validations.simple_form as well
Can you try the master branch please and let me know if the same issue is happening.
I have the same error, but only in edit form loaded via js. I tried both master
and client_side_validations (3.2.0.beta.6)
.
The edit form has the id: "edit_review_971" .
Validations work fine for new_review forms loaded via js and for normally loaded edit forms.
Setup: rails 3.2.8 simple_form 2.0.2 client_side_validations-simple_form 2.0.0.beta.2
@kamelury would it be possible for you to create an example at demonstrating the problem? I cannot seem to recreate and this would be a huge help.
I was able to recreate this in my code, but it's because I'm hacking. I wanted to prevent a few form fields from being submitted to the server, so I was setting their "name" attributes to null in some js on page load. Once the elements have no names, they lose some of their wiring to their validations, and these errors result. Not sure if it's the same cause.
Yeah it will probably cause issues if the names are removed. Ideally the code should handle this gracefully. I'll see about covering this edge case.
I had this same issue using the same stack and had to change clientSideValidations to capital ClientSideValidations in my custom javascript. Just in case that's relevant to anyone else's problems!
@jbodily the master branch changed the from clientSideValidations
to ClientSideValidations
. This is undocumented but I will make notes of it for upgrades when 3.2's RC comes out
Thanks everyone for hints and suggestions. I found the origin of the problem while preparing an example for demonstration. In my case the issue had nothing to do with client_side_validations. It was the way the form html was inserted.
@mledom ca I get a follow up on this issue?
I will look at it tonight and get back to you then. Should I upgrade to the 3.2 RC?
didn't mean to close it, sorry.
@mledom if you could use the master branch on Github that would be great. Thank you!
Looks like that's working for me. Great work on getting 3.2 out there.
@mledom awesome, thank you very much for following up on this :)
I had the same error and then I found error there, I used <%= form_for @zipcode, html: { class: "form-horizontal", validate: true } do |f| %> when I replaced it with this code everything started work fine <%= form_for @zipcode, html: { class: "form-horizontal" }, validate: true do |f| %> Best wishes
I'm getting the Uncaught TypeError: Cannot read property 'validators' of undefined when trying to validate a field. I've trying to figure out where window.ClientSideValidations.forms is being populated with anything other than the initialization window.ClientSideValidations = { forms: {} I'm using: