For CiviContribute forms in WordPress that have predefined fixed amounts ($25, $50, $100, ...) and that also allow an "Other" amount, it seems that the javascript that is supposed to clear the fixed amount radio buttons when an "other" amount is filled in is broken. I'm using Civi v.5.4.0 in WordPress v.4.9.9.

The malfunctioning behavior is also reported here, but the CMS is not indicated. A couple javascript solutions are posted— but this should work out of the box with Civi, right?

Looking under the covers, I see there are javascript functions clearAmountOther() and useAmountOther() that are wired to the onclick events for the radio buttons. However, the DOM structure the code refers to is invalid. There is no document.Main.amount_other.

function clearAmountOther() {
  var priceset = 0
  if( priceset ){
  if (document.Main.amount_other == null) return; // other_amt field not present; do nothing
  document.Main.amount_other.value = "";

As a result, if you select a fixed amount like $25 and then enter $40 into the "Other Amount" box, the contribution is the sum $65. This is likely to surprise donors!

Is this a known issue? A bug that needs to be fixed?

  • I think a patch on this would definitely be welcome, assuming this problem exists on the latest version of Civi. I would expect it does, frankly. I recommend opening an issue on lab.civicrm.org. – Jon G - Megaphone Tech Jan 20 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.