CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Howto change form field sizes
Pages: [1]

Author Topic: Howto change form field sizes  (Read 2208 times)

stevewickii

  • Guest
Howto change form field sizes
June 17, 2008, 04:14:48 pm
I am using CiviCRM 1.9, and I need to change the size of several input elements.  Individuals > Current Employer, Individuals > Street Address > Home, and Individuals > Home URL.  The size attribute of these input elements is currently set to 45.  I need to change them to 30 to fit within my fixed width, centered layout.

How do I do this?

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Howto change form field sizes
June 18, 2008, 12:01:44 am

Can u check the value of $attributes['first_name'] in CRM/Contact/Form/Individual.php,
I suspect the size should be 30. I think for display problem better solution would be doing it with css where u can use classes to reduce textbox size. Check how its done for middle name in Edit.tpl

HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

stevewickii

  • Guest
Re: Howto change form field sizes
June 18, 2008, 09:52:03 am
I see.  The size and maxlength of each field is hard coded into CRM/Contact/DAO/Individual.php.

Exerpt from CRM/Contact/DAO/Individual.php
Code: [Select]
                'first_name' => array(
                    'name' => 'first_name',
                    'type' => CRM_Utils_Type::T_STRING,
                    'title' => ts('First Name') ,
                    'maxlength' => 64,
                    'size' => CRM_Utils_Type::BIG,
                    'import' => true,
                    'where' => 'civicrm_individual.first_name',
                    'headerPattern' => '/^first|(f(irst\s)?name)$/i',
                    'dataPattern' => '/^\w+$/',
                    'export' => true,
                ) ,
                'middle_name' => array(
                    'name' => 'middle_name',
                    'type' => CRM_Utils_Type::T_STRING,
                    'title' => ts('Middle Name') ,
                    'maxlength' => 64,
                    'size' => CRM_Utils_Type::BIG,
                    'import' => true,
                    'where' => 'civicrm_individual.middle_name',
                    'headerPattern' => '/^middle|(m(iddle\s)?name)$/i',
                    'dataPattern' => '/^\w+$/',
                    'export' => true,
                ) ,
                'last_name' => array(
                    'name' => 'last_name',
                    'type' => CRM_Utils_Type::T_STRING,
                    'title' => ts('Last Name') ,
                    'maxlength' => 64,
                    'size' => CRM_Utils_Type::BIG,
                    'import' => true,
                    'where' => 'civicrm_individual.last_name',
                    'headerPattern' => '/^(l(ast\s)?name)$/i',
                    'dataPattern' => '/^\w+(\s\w+)?+$/',
                    'export' => true,
                ) ,

I will try to find a way to apply CSS directives to a form field.  If I can't do that, I guess I'll have to modify the Individual.php.

Thanks Yashodha!

stevewickii

  • Guest
Re: Howto change form field sizes
June 18, 2008, 10:15:22 am
Okay, here's how I did it.

In addition to the size and maxlength attributes of the input elements, CiviCRM uses classes to control the size of it's form fields.  The file civicrm/css/civicrm.css controls the form fields by default.  I changed these directives by copying them to my theme's style.css file, and changed the values.

I added the following code to my theme's style.css file
Code: [Select]
#crm-container .big
{
  width: 15em;
}
#crm-container .huge
{
  width: 15em;
}

Hope this helps!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Howto change form field sizes

This forum was archived on 2017-11-26.