webform submit button is non-responsive for zero-dollar contribution amount
Versions:
- Drupal 9
- CiviCRM 5.58.1
- Webform 6.1.3
- Webform CiviCRM 6.2.1
- Stripe 6.8.2
- PaymentShared 1.2.11
Setup: A simple webform (Drupal config export YAML attached as webform-export.yml), with these configs notable:
- One existing contact
- Contribution
- Processor: Stripe
- Amount: a two-option radio button set:
- "zero" for $0.00
- "one" for $1.00
- Two webform pages only. All fields are on the first page; only the "Submit button(s)" action is on the second page.
Repro 1: Proper behavior for $1.00 amount:
- Open the form and fill all fields as you wish
- For the Amount field, select "one" for $1.00
- Click next; observe second/final page appears.
- Observe Stripe payment block appears; observe total due is $1.00; fill in credit card details and click Submit.
- Observe SweetAlert "please wait" message. Form is submitted. Observe form redirects correctly and displays confirmation message.
- Find the contribution record in CiviCRM. Observe that it was recorded properly.
Repro 2: Bad behavior for $0.00 amount:
- Open the form and fill all fields as you wish
- For the Amount field, select "zero" for $0.00
- Click next; observe second/final page appears.
- Observe total due is $0.00; observe Stripe payment block does not appear. Click Submit.
- Observe no discernable change in the page as a result of the Submit click. (The Submit button appears to be completely non-functional.)
Technical notes:
- Inspection of JavaScript in browser devtools reveals that the Submit click proceeds as far as line 605 of js/civicrmStripe.js. The stack trace shows that the calling function was line 438 of the same file.
- Per the JS file, the comment above line 605 says "If we have selected Stripe but amount is 0 we don't submit via Stripe", so this it seems intentional that the Stripe processing should end here; however it's probably not intentional that the entire webform submission ends prematurely as it does.
See also:
-
#383 "Webform won't allow user to submit if total is zero"
- This may be the same issue, but that ticket relates to multi-participant event registration and a more complex webform with conditional behaviors.
- #383 suggests a possible work-around by moving one or more fields to one of the pages before the last "submit buttons" page; in my case I've made sure there are no field at all on that last page.
(Joinery internal reference: Asana 1204591534877896)