Answers.Body: <p>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.  </p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <ol>
  <li>Somewhere in your WordPress theme</li>
  <li>In an extension you write, using the <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Resource+Reference" rel="nofollow">Resource</a> addScriptFile method to add a script within <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm" rel="nofollow">hook_civicrm_buildform</a> (the preferred method)</li>
  <li>Using an <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Page+Templates" rel="nofollow">.extra.tpl file</a> in your template override directory</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T02:18:49.503Z
Answers.Text: 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 http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm
Answers.UserDisplayName: Joe Murray
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T05:30:48.043Z
Answers.Text: 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.
Answers.UserDisplayName: jursulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T01:54:13.843Z
Answers.LastActivityDate: 2015-05-28T01:54:13.843Z
Answers.UserDisplayName: Andie Hunt
Body: <p>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.</p>
  
  <p>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. </p>
  
  <p><a href="http://www.thewellspringfoundation.org/donate/test/">Here's a page with the form in test mode</a></p>
  
  <p>I'm not all that good with code, but did look with Developer Tools and found this:</p>
  
  <pre><code>&lt;!-- .tpl file invoked: CRM/Contribute/Form/Contribution/Main.tpl. Call via form.tpl if we have a form in the page. --&gt;
  </code></pre>
  
  <p>I looked at Main.tpl (lines 147-177) but don't understand enough to remove the checked="checked" attribute from the input tag.</p>
  
  <pre><code>{if $form.is_recur}
  &lt;div class="crm-section {$form.is_recur.name}-section"&gt;
  &lt;div class="label"&gt;&amp;nbsp;&lt;/div&gt;
  &lt;div class="content"&gt;
    {$form.is_recur.html} {$form.is_recur.label} {ts}every{/ts}
  {if $is_recur_interval}
      {$form.frequency_interval.html}
    {/if}
    {if $one_frequency_unit}
      {$frequency_unit}
      {else}
      {$form.frequency_unit.html}
    {/if}
    {if $is_recur_installments}
      &lt;span id="recur_installments_num"&gt;
      {ts}for{/ts} {$form.installments.html} {$form.installments.label}
      &lt;/span&gt;
    {/if}
    &lt;div id="recurHelp" class="description"&gt;
      {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}
      {if $is_email_receipt}
        {ts}You will receive an email receipt for each recurring contribution.{/ts}
      {/if}
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="clear"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>{/if}</p>
  
  <p>Thanks in advance.</p>
  
Tags: <civicontribute><recurring-contributions>
Title: How do I uncheck the recurring contribution check box by default?
ThreadText: # How do I uncheck the recurring contribution check box by default?
  
  (Asked by: username_0 on 2015-05-27)
  
  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:
  
  
  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}
  
   
  
    {$form.is_recur.html} {$form.is_recur.label} {ts}every{/ts}
  {if $is_recur_interval}
      {$form.frequency_interval.html}
    {/if}
    {if $one_frequency_unit}
      {$frequency_unit}
      {else}
      {$form.frequency_unit.html}
    {/if}
    {if $is_recur_installments}
      
      {ts}for{/ts} {$form.installments.html} {$form.installments.label}
      
    {/if}
    
      {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}
      {if $is_email_receipt}
        {ts}You will receive an email receipt for each recurring contribution.{/ts}
      {/if}
    
  
  
  
  {/if}
  Thanks in advance.
  
  **Tags:** civicontribute, recurring-contributions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-28. Score: 4 | Accepted answer
  
  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](http://wiki.civicrm.org/confluence/display/CRMDOC/Resource+Reference) addScriptFile method to add a script within [hook\_civicrm\_buildform](http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm) (the preferred method)
  3. Using an [.extra.tpl file](http://wiki.civicrm.org/confluence/display/CRMDOC/Page+Templates) in your template override directory
  
  > **Comments:**
  > **username_2**: 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 http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm  
  > **username_0**: 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.  
  
  ---
  
  