Giter VIP home page Giter VIP logo

Comments (3)

bendrucker avatar bendrucker commented on June 14, 2024

Sorry but I'm not going to parse the value of ngRequire and not validate if it's false. If you can explain your use case in a little more detail I'm happy to help you with a more direct solution.

from angular-credit-cards.

geuis avatar geuis commented on June 14, 2024

It seems that your module should support the native validation capabilities in Angular. Its odd that if the code is specifically saying, "Don't validate this input" via ng-required="false", that the module is validating anyway.

In my scenario, we only need to validate the credit card field when entering a new card. When editing an existing card, we only send the last 4 digits of the card to the client. Pretty standard.

The same form is used for both creating and editing card data (name, address, number, cvv, etc). When editing an existing card, the number input is not shown and a span is visible with the 'xxxx-xxxx-xxxx-1234' style for the number. This is the situation where your module should respect ng-required="false" because the input is in the form, but is not being used for this interaction. However, your module is still trying to validate a control when its being instructed not to.

from angular-credit-cards.

stevensmith007 avatar stevensmith007 commented on June 14, 2024

Hello, here's another case where this would be appreciated.
In my form, the user can checkout 2 ways.

  1. Using the checkout with Paypal button
  2. Entering his credit card information and sending it to Stripe.

The form consists of two radio buttons. Paypal hides the credit card form while the other one shows it.

No matter if the credit card is visible or not, the form is never validated because it's expecting a credit card number, expiration date and CVC.

Normally, I would simply set ng-required="isPaidByCreditCard" to ask for validation. In the case of angular-credit-card, this does not work.

Do you know an alternative? Create / remove the credit card form when needed instead of hiding / showing it?

Thank you for your time.


UPDATE: I managed to get it working by adding ng-form around the credit card form and then bypassing it's validation if Paypay button was selected.

from angular-credit-cards.

Related Issues (20)

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.