Answers.Body: <p>First - don't edit anything in the templates_c directory!  These are cached pre-compiled copies of the template, and are frequently cleared out.</p>
  
  <p>Second - it's not advisable to edit the templates that ship with CiviCRM directly, because you'll have to apply your changes on every upgrade.</p>
  
  <p>The best practice is to install <a href="https://github.com/totten/civix" rel="nofollow">civix</a> and create an extension, but in your case, I don't see the harm of using a template override, and more specifically a ".extra.tpl" file.</p>
  
  <p><a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Page+Templates" rel="nofollow">This wiki page</a> has all the information you need.  I would start by just creating a "custom templates" directory, and make sure you can successfully implement your change with a normal template override.  Then remove your override and reimplement using a .extra.tpl file, and your change should be OK through most upgrades.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-03T13:05:07.500Z
Answers.LastActivityDate: 2016-05-03T13:05:07.500Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>With Drupal you can easily inject some JS for specific CiviCRM URLs - this example is for an event/registration page - but this should work for all urls.</p>
  
  <pre><code>function myorg_zen_preprocess_page(&amp;$variables, $hook) {
      if (strpos(request_path(), 'civicrm/event/register') === 0) {
        drupal_add_js(drupal_get_path('theme', 'myorg_zen') . '/js/civicrm-event-register.js');
      }
  }
  </code></pre>
  
  <p>and then in that js file - you can add all the js you need/want to change/re-arrange the elements on that civicrm page. Things we often do:</p>
  
  <ul>
  <li><p>show/hide custom fields based on change in the price option selected</p></li>
  <li><p>replace the ugly black CiviCRM buttons with nice colorful modern sass
  buttons </p></li>
  <li>style the #google_map </li>
  <li>control whether the default for is_recurring on contribution pages
  that allow recurring contributions - is checked - or not</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-03T17:03:53.227Z
Answers.LastActivityDate: 2016-05-03T17:03:53.227Z
Answers.UserDisplayName: KarinG - Semper IT
Body: <p>I am currently trying to edit : sites/default/files/civicrm/templates_c/CRM/Contribute/Form/Contribution/Main.tpl</p>
  
  <p>to try and alter when select box A of pricesets are chosen then hide an option in select box B, as I understand civi used a different kind of jquery select box is there anyway I can hide it so that the options do not come available as I already hide the original   part but its still available</p>
  
  <p>thank you</p>
  
Tags: <civicontribute><contribution-page><price-sets><javascript>
Title: hide select box options in contributed page
ThreadText: # hide select box options in contributed page
  
  (Asked by: username_0 on 2016-05-02)
  
  I am currently trying to edit : sites/default/files/civicrm/templates\_c/CRM/Contribute/Form/Contribution/Main.tpl
  
  to try and alter when select box A of pricesets are chosen then hide an option in select box B, as I understand civi used a different kind of jquery select box is there anyway I can hide it so that the options do not come available as I already hide the original part but its still available
  
  thank you
  
  **Tags:** civicontribute, contribution-page, price-sets, javascript
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-05-03. Score: 2
  
  First - don't edit anything in the templates\_c directory! These are cached pre-compiled copies of the template, and are frequently cleared out.
  
  Second - it's not advisable to edit the templates that ship with CiviCRM directly, because you'll have to apply your changes on every upgrade.
  
  The best practice is to install [civix](https://github.com/totten/civix) and create an extension, but in your case, I don't see the harm of using a template override, and more specifically a ".extra.tpl" file.
  
  [This wiki page](https://wiki.civicrm.org/confluence/display/CRMDOC/Page+Templates) has all the information you need. I would start by just creating a "custom templates" directory, and make sure you can successfully implement your change with a normal template override. Then remove your override and reimplement using a .extra.tpl file, and your change should be OK through most upgrades.
  
  
  ---
  
  ### Answer by username_2 on 2016-05-03. Score: 1
  
  With Drupal you can easily inject some JS for specific CiviCRM URLs - this example is for an event/registration page - but this should work for all urls.
  
  ```
  function myorg_zen_preprocess_page(&$variables, $hook) {
      if (strpos(request_path(), 'civicrm/event/register') === 0) {
        drupal_add_js(drupal_get_path('theme', 'myorg_zen') . '/js/civicrm-event-register.js');
      }
  }
  
  ```
  
  and then in that js file - you can add all the js you need/want to change/re-arrange the elements on that civicrm page. Things we often do:
  
  * show/hide custom fields based on change in the price option selected
  * replace the ugly black CiviCRM buttons with nice colorful modern sass
    buttons
  * style the #google\_map
  * control whether the default for is\_recurring on contribution pages
    that allow recurring contributions - is checked - or not
  
  
  ---
  
  