Skip to main content

Make custom donation field required in Bootstrap staged donations

Hello, I'm using staged donations with Bootstrap, and I've added some custom donation fields to Stage 2 of the form. One of the fields is a checkbox that they've accepted the terms and conditions. I would like this checkbox to be required before being able to move to Stage 3 of the donation (payment). I've tried just adding the usual – required:"required", and I've tried the workaround suggested by Brian Palmer here: http://nationbuilder.com/alisharayner/make_custom_fields_required, but neither of these work within the staged donations. I think I need to edit the staged donation .js file, but not sure. Here a link to the site: https://foodshed-mcfoodcoop.nationbuilder.com/become-an-owner. Thanks!

Official response from

Hi Alison!

You could always add new JS to the page that does form validation on that checkbox and have the validation fire on the 'onclick' event of clicking the "Continue" button, but you are correct in that it is probably easier to add it to the existing validation script in the "staged-donations.js" file. The link below shows my proposed changes to that JS file, with the current (default) file on the left and the updated (proposed) version on the right: https://www.diffchecker.com/AXouERCO

I tested this out and it does work, but you may need to add some additional JS or CSS to better format/style the error message.

Share this post

Showing 3 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.