Git Product home page Git Product logo

live-validations's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

live-validations's Issues

support form_tag

Support also form_tag with livevalidations and not only form_for

Support for custom form id

Live-validations uses a self generated dom_id to id the html form. I would like to use my own custom form id and still keep the live-validations functionality

Incorrect form element naming, missing underscores

Live validations was not working on my freshly generated scaffolding.

It was not working because there are underscores in my form field names generated by rails but not in the javascript generated by the live_validations plugin.

Here is an example:



$('#new_sms_message').validate({"messages": {"smsmessage[number]": {"required": "can't be blank", "digits": "is not a number"}, "smsmessage[message]": {"required": "can't be blank"}}, "rules": {"smsmessage[number]": {"required": true, "minlength": 10, "digits": true}, "smsmessage[message]": {"required": true, "maxlength": 160}}})

// Manually corrected the javascript and it worked correctly:

 $('#new_sms_message').validate({"messages": {"sms_message[number]": {"required": "can't be blank", "digits": "is not a number"}, "sms_message[message]": {"required": "can't be blank"}}, "rules": {"sms_message[number]": {"required": true, "minlength": 10, "digits": true}, "sms_message[message]": {"required": true, "maxlength": 160}}})


validates_uniqueness_of when editing an object

Validates_uniqueness_of works great when creating a new record but not when I attempt to edit data of an existing record.

Maybe there is something wrong on my end.

For example, I have a user and validate_uniqueness_of the email and username.

I allow the user the ability to change their email address (but still want to validate it's uniqueness)

Whenever I try to save the record I was editing, I get the "has already been taken" validation error (it's only taken by the current user). It gives this error even if I was changing other fields that are not validated. When I turn off live validations the regular rails validations work fine.

Also, I'm using validates_confirmation_of :password; and it is validating and showing the error "doesn't match confirmation" even though nothing was entered in the new_password field.

Is there any explanation of this behavior? Is live validations only meant to validate records before creation and not for editing? I have gotten around the issue by only validating my fields on create but I want to make sure the user's email is unique even when they are editing their account settings.

Thanks for any tips.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.