Obviously, I want to provide the option for recurring but I do not want it to load the page with default recurring selected. I think this is the way most administrators would want it to work. Should be simple, right?
2 Answers
Actually in the iATS Extension we've gone back and forth on this but are now "is.checked" as many orgs/administrators make special "Donate monthly now" pages with specific appropriate defaults for monthly $amounts like $25 or $50 - typically less than the default on a "Donate one time" page. On a Donate monthly to get people through without extra checking of boxes - the default is now is.checked (if recurring is an option). To uncheck that box you need to add some Javascript.
This is what you want:
$('#is_recur').attr('checked', false);
There are several ways to go about adding this [and not sure this is the best one - but it's one that I understand, it's what I typically do] - on Drupal 7:
In the theme's template.php - when preprocessing a page - I'll insert js - based on path:
So if we're on a civicrm/event/transact
url -> then load civicrm-recurring.js
and that civicrm-recurring.js
file lives in the theme's js directory and looks like:
-
Sorry so late to respond, Karin! Thank you! Unfortunately, I do not know how to code this or where to put it precisely. Can you give me a code snippet and instructions about where to place it (a file path). Sep 1, 2017 at 22:19
-
Hi John! I've added details above. Give that a try - and let me know if you have any further questions; Sep 2, 2017 at 16:48
Apparently, enabling the iATS ACG/EFT payment processor on a donation page causes the recurring checkbox to be pre-checked. We're using CiviCRM with WordPress, with a child theme and a custom page template for the CiviCRM front end page. I was able to automatically uncheck the recurring checkbox by simply adding the following javascript to the CiviCRM page template, just after the content section:
<script type="text/javascript">
document.getElementById("is_recur").checked = false;
</script>