I've searched here and on the CiviCRM forum but haven't been able to find an answer to what I was hoping would be fairly simple.

I want to give people the option of making their contribution recurring, however I don't want the checkbox checked when the form loads I only want the checkbox checked if the user selects it. This is to avoid an embarrassing situation a month down the road when we process their donation again.

Here's a page with the form in test mode

I'm not all that good with code, but did look with Developer Tools and found this:

<!-- .tpl file invoked: CRM/Contribute/Form/Contribution/Main.tpl. Call via form.tpl if we have a form in the page. -->

I looked at Main.tpl (lines 147-177) but don't understand enough to remove the checked="checked" attribute from the input tag.

{if $form.is_recur}
<div class="crm-section {$form.is_recur.name}-section">
<div class="label">&nbsp;</div>
<div class="content">
  {$form.is_recur.html} {$form.is_recur.label} {ts}every{/ts}
{if $is_recur_interval}
  {if $one_frequency_unit}
  {if $is_recur_installments}
    <span id="recur_installments_num">
    {ts}for{/ts} {$form.installments.html} {$form.installments.label}
  <div id="recurHelp" class="description">
    {ts}Your recurring contribution will be processed automatically.{/ts}
    {if $is_recur_installments}
      {ts}You can specify the number of installments, or you can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time.{/ts}
    {if $is_email_receipt}
      {ts}You will receive an email receipt for each recurring contribution.{/ts}
<div class="clear"></div>


Thanks in advance.

1 Answer 1


You're in the right place to see what's going on, but the wrong spot to do anything. The field will arrive in the template fully-rendered, within {$form.is_recur.html} or an equivalent Smarty variable. Editing the template won't help you there.

The form PHP code would allow you to change it, but that's not the best way to go about this: doctoring core CiviCRM code is a bad idea, and while there's a way to set up override files for code files, it's a clunky method. Besides, you'd have to navigate Quickform, which is a headache in itself.

The better approach to forcing a checkbox checked or not is to use jQuery. You'll have CSS-style selectors, so you won't need to troll through the templates to see where to alter the box. You can add your code in one of three places:

  1. Somewhere in your WordPress theme
  2. In an extension you write, using the Resource addScriptFile method to add a script within hook_civicrm_buildform (the preferred method)
  3. Using an .extra.tpl file in your template override directory
  • 1
    3 would be my recommendation, then 2, then 1. If you already have an extension built for other purposes, then you could consider implementing a hook on buildForm to set the default. See wiki.civicrm.org/confluence/display/CRMDOC/…
    – Joe Murray
    Commented May 28, 2015 at 2:18
  • Thanks Andrew. I was pretty sure that {$form.is_recur.html} was the variable I wanted to look at, I just didn't know where it was defined. I definitely don't want to mess with core files, so I'll try the jQuery route. Thanks.
    – jursulak
    Commented May 28, 2015 at 5:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.