Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-11666

Contribute form rule requires credit card fields for front-end $0 contributions and event registration

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.0
    • Component/s: Accounting Integration
    • Labels:
      None

      Description

      Regression was caused by change to pass REQUIRED = TRUE param to CRM_Core_Payment_Form::buildCreditCard() in CRM_Core_Payment_ProcessorForm::buildQuickform(). I think this was done to help support client side validation. However, it forces all billing fields to have required attribute at quickform level - so it can't handle exceptions like $0 transactions.

      I reverted that change and then added markup to CRM/Core/BillingBlock.tpl so that the billing fields 'display' as required. The formRules in Main.php enforce the requirements conditionally (server side).

      ---- Original Post ----
      While working on CRM-10888 dgg and I noticed that jQuery validate was requiring credit card fields even if the contribution amount was set to $0. I thought disabling clientside validation for contribution forms would be the easiest fix, but unfortunately when I did so I found that the server-side form rule was making the same mistake. I assume this is a regression from a previous version because there appears to be some server-side special validation logic to bypass the form rule when amount is 0 (although I haven't actually tested it in 4.2).
      Since this bug affects both the client-side and the server-side an ideal solution would address both and allow us to re-enable jQuery validate. From a UX perspective I think the ideal solution would also hide the credit card fields when they are not needed.

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              colemanw Coleman Watts
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: