MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-88

Add ability for credit card validator to choose card type based on another component

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Validators
    • Labels:
      None

      Description

      It would be nice if the credit card validator could, in one of its attributes, optionally specify the ID of another component, whose value should be used to determine which card type should be used in the validation. This would come in handy for forms that have a select-one component with a list of credit card types. I would think that forms with both card type and card number are common.

      Example of tags:

      <%-- Credit Card Type --%>
      <h:outputLabel for="cardType" value="Credit Card Type"/>
      <h:selectOneMenu id="cardType" value="#

      {backingBean.cardType}

      " required="true">
      <f:selectItems value="#

      {backingBean.cardTypeSelectItems}

      "/>
      </h:selectOneMenu>

      <%-- Credit Card Number --%>
      <h:outputLabel for="cardNumber" value="Credit Card Number"/>
      <h:inputText id="cardNumber" value="#

      {backingBean.cardNumber}

      " required="true">
      <t:validateCreditCard forCardType="cardType"/>
      </h:inputText>

      The code would have to make an assumption about what values from the card type map to which credit cards. The values amex, visa, mastercard, and discover seem appropriate.

      I may get around to adding this ability, in which case I will attach the patches here. If I don't, though, I wanted to capture this suggestion in case someone else wants to do it.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Matthias Weßendorf
            Reporter:
            Ken Weiner
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development