CRM-14081 - Alternate approach preserves useful focus behavior by default and elimina...
authorDave Greenberg <dave@civicrm.org>
Fri, 17 Jan 2014 02:45:02 +0000 (18:45 -0800)
committerDave Greenberg <dave@civicrm.org>
Fri, 17 Jan 2014 02:45:02 +0000 (18:45 -0800)
----------------------------------------
* CRM-14081: Create Contribution screen initially scrolls to and puts cursor in "Soft Credit" field
  http://issues.civicrm.org/jira/browse/CRM-14081

templates/CRM/Contact/Form/NewContact.tpl
templates/CRM/Contribute/Form/SoftCredit.tpl

index 41d5f35b33c597d5f01b876ceb440b884826931a..d8f541ce312fb034118e589b337afd689991543f 100644 (file)
@@ -27,7 +27,9 @@
 {if !in_array($context, array('search','advanced', 'builder')) || $parent eq 'activity'}
   {assign var='fldName' value=$prefix|cat:'contact'}
   {assign var='profSelect' value=$prefix|cat:'profiles'}
-
+       {* Focus on select contact element unless focus=false is passed in. *}
+       {assign var='focus' value=$focus|default:true}
+       
   {if $noLabel}
     <div>
       {if !$skipBreak}
         eval("{$newContactCallback}");
       {/if}
       {literal}
-    }).focus( );
+    }){/literal}{if $focus}.focus( ){/if}{literal};
 
     cj( contactElement ).click( function( ) {
       cj( contactHiddenElement ).val('');
index 878f22203d248e23af26531a24e8f94292e1cfeb..ec31a6d66dee6335d2116a252db894fc40638dc8 100644 (file)
@@ -37,7 +37,7 @@
           {assign var='createNewStatus' value=false}
         {/if}
         {include file="CRM/Contact/Form/NewContact.tpl" noLabel=true skipBreak=true blockNo=$rowNumber
-        prefix="soft_credit_" showNewSelect=$createNewStatus}
+        prefix="soft_credit_" showNewSelect=$createNewStatus focus=false}
       </td>
       <td>
         {$form.soft_credit_amount.$rowNumber.label}&nbsp;{$form.soft_credit_amount.$rowNumber.html|crmAddClass:eight}