AnsweredAssumed Answered

Force Text Box Input Fields to UPPERCASE

Question asked by community-support on Jan 13, 2014
Latest reply on Jan 13, 2014 by community-support
Hi,

I'm trying to Force Text Box Input Fields to UPPERCASE...

Version Version 6.5.16 (Build 1082)

I've copied  '/.../crm/modules/Accounts/metadata/editviewdefs.php' to '/.../crm/custom/modules/Accounts/metadata/editviewdefs.php'

I've followed suggestion in thread 'http://forums.sugarcrm.com/f6/change-...'

Having problem with following line (see below) :   'javascript'=>'onchange='valueToUpper('.'name'.');'',

Don't know how to PASS the 'name' variable to the javascript function...

Objective is to have any characters entered, to be converted immediately into UPPERCASE...

Can anyone help for correct way to do this, please?

Thanks!

Following is complete code for modified 'editviewdefs.php':

*******************************************************************************

$viewdefs['Accounts']['EditView'] = array(

     'templateMeta' => array(

                             'form' => array('buttons'=>array('SAVE', 'CANCEL')),

                             'maxColumns' => '2',

                             'widths' => array(

                                             array('label' => '10', 'field' => '30'),

                                             array('label' => '10', 'field' => '30'),

                                             ),

                             'includes'=> array(

                                             array('file'=>'modules/Accounts/Account.js'),

                                          ),

                            ),

'javascript' => '

function valueToUpper(field) {

   field.value = field.value.toUpperCase();

}

',                        

     'panels' => array(

       'lbl_account_information' =>

       array (

         array (

           array (

             'name' => 'name',

             'label' => 'LBL_NAME',

             'displayParams' =>

             array (

               'required' => true,

   'javascript'=>'onchange='valueToUpper('.'name'.');'',

             ),

           ),

           array (

             'name' => 'phone_office',

             'label' => 'LBL_PHONE_OFFICE',

           ),

         ),

         array (

           array (

             'name' => 'website',

             'type' => 'link',

             'label' => 'LBL_WEBSITE',

           ),

           array (

             'name' => 'phone_fax',

             'label' => 'LBL_FAX',

            ),

         ),

         array (

           array (

             'name' => 'billing_address_street',

             'hideLabel' => true,

             'type' => 'address',

             'displayParams' =>

             array (

               'key' => 'billing',

               'rows' => 2,

               'cols' => 30,

               'maxlength' => 150,

            ),

           ),

           array (

             'name' => 'shipping_address_street',

             'hideLabel' => true,

             'type' => 'address',

             'displayParams' =>

             array (

               'key' => 'shipping',

               'copy' => 'billing',

               'rows' => 2,

               'cols' => 30,

               'maxlength' => 150,

             ),

           ),

         ),

         array (

           array (

             'name' => 'email1',

             'studio' => 'false',

             'label' => 'LBL_EMAIL',

           ),

         ),

         array (

           array (

             'name' => 'description',

             'label' => 'LBL_DESCRIPTION',

           ),

         ),

       ),

       'LBL_PANEL_ADVANCED' =>

       array (

         array (

           'account_type',

           'industry'

         ),

         array (

           'annual_revenue',

           'employees'

         ),

         array (

           'sic_code',

           'ticker_symbol'

         ),

         array (

           'parent_name',

           'ownership'

         ),

         array (

           'campaign_name',

           'rating'

         ),

       ),

       'LBL_PANEL_ASSIGNMENT' =>

       array (

         array (

           array (

             'name' => 'assigned_user_name',

             'label' => 'LBL_ASSIGNED_TO',

           ),

         ),

       ),

     )

);

?>

*******************************************************************************

(from jhumbert)

Outcomes