Merge pull request #5822 from eileenmcnaughton/tests
[civicrm-core.git] / templates / CRM / Contribute / Form / SoftCredit.tpl
index b9e762e6f9f4905daf89ced8e9d720edda333f4c..d78bdb1f89729f929f95505007c7ef8f3b1a33c0 100644 (file)
@@ -1,8 +1,8 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -59,7 +59,7 @@
   {/section}
   <tr>
     <td>
-      <a href="#" class="crm-hover-button" id="addMoreSoftCredit"><span class="icon add-icon"></span> {ts}another soft credit{/ts}</a>
+      <a href="#" class="crm-hover-button" id="addMoreSoftCredit"><span class="icon ui-icon-circle-plus"></span> {ts}another soft credit{/ts}</a>
     </td>
   </tr>
 </table>
@@ -67,7 +67,7 @@
 {literal}
 <script type="text/javascript">
   CRM.$(function($) {
-    var $form = $("#{/literal}{$form.formName}{literal}");
+    var $form = $("form.{/literal}{$form.formClass}{literal}");
     $('#showPCP, #showSoftCredit').click(function(){
       return showHideSoftCreditAndPCP();
     });
       return false;
     });
 
-    $('input[name^="soft_credit_contact["]').change(function(){
-      var rowNum = $(this).prop('id').replace('soft_credit_contact_','');
+    $('input[name^="soft_credit_contact_"]').on('change', function(){
+      var rowNum = $(this).prop('id').replace('soft_credit_contact_id_','');
       var totalAmount = $('#total_amount').val();
       //assign total amount as default soft credit amount
       $('#soft_credit_amount_'+ rowNum).val(totalAmount);
       var thousandMarker = {/literal}{$config->monetaryThousandSeparator|json_encode}{literal};
-      $('#soft_credit_type_'+ rowNum).val($('#sct_default_id').val());
+      $('#soft_credit_type_'+ rowNum).select2('val', $('#sct_default_id').val());
       totalAmount = Number(totalAmount.replace(thousandMarker,''));
       if (rowNum > 1) {
         var scAmount = Number($('#soft_credit_amount_'+ (rowNum - 1)).val().replace(thousandMarker,''));