Jump to content


Photo

How to increase text field's lenght

Lenght text field Full Name

  • Please log in to reply
4 replies to this topic

#1 guidoeffe

guidoeffe

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 20 June 2014 - 10:08 AM

Hallo,
I'll need to increase the lenght of some text fields.
 
I've done it  into mysql table (Varchar maximum set to 255 characters)
but I don't know where to set it into the php code ( insert/edit form and import process check).
For us it's a critical issue.
 
Thank you for all the help you can give me.
Guido


#2 RobertLKO

RobertLKO

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 02 July 2014 - 06:05 PM

I am not a developer just user and I did it directly via the "Designer" function (under "Administration") where you could modify the length of the text fields, no coding required.



#3 guidoeffe

guidoeffe

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 03 July 2014 - 06:47 AM

Thank you very much, but it's not all right.
 
In the design panel not so many standard fields have the configuration option and into the options the maximum length is visible but not settable.
 
The alternative should be to add custom fields instead of the standard ones but look like a undesiderable patch.
 
Thanks again.
guido


#4 speixoto

speixoto

    Advanced Member

  • Members
  • PipPipPip
  • 386 posts

Posted 03 July 2014 - 07:18 AM

To increase the mas lenght of a standard field you can go to the related model (ex: Account.php) and edit the getDefaultMetadata rules.

'rules' => array(
                    array('annualRevenue', 'type',    'type' => 'float'),
                    array('description',   'type',    'type' => 'string'),
                    array('employees',     'type',    'type' => 'integer'),
                    array('latestActivityDateTime',  'readOnly'),
                    array('latestActivityDateTime',  'type', 'type' => 'datetime'),
                    array('name',          'required'),
                    array('name',          'type',    'type' => 'string'),
                    array('name',          'length',  'min'  => 1, 'max' => 64),
                    array('officePhone',   'type',    'type' => 'string'),
                    array('officePhone',   'length',  'min'  => 1, 'max' => 24),
                    array('officeFax',     'type',    'type' => 'string'),
                    array('officeFax',     'length',  'min'  => 1, 'max' => 24),
                    array('website',       'url',     'defaultScheme' => 'http'),
                ),


#5 guidoeffe

guidoeffe

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 24 July 2014 - 09:28 AM

Thank you for this information.
 
To complete this topic I have discovered the zurmo's basic models.
So, if you want to increase the text lenght, for example, for the address you have to change the address.php file into modules/zurmo/models
 
                'rules' => array(
                    array('city',       'type',      'type'      => 'string'),
                    array('city',       'length',    'max'       => 32),
                    array('country',    'type',      'type'      => 'string'),
                    array('country',    'length',    'max'       => 32),
                    array('invalid',    'boolean'),
                    array('latitude',   'type',      'type'      => 'float'),
                    array('latitude',   'length',    'max'       => 12),
                    array('latitude',   'numerical', 'precision' => 7),
                    array('longitude',  'type',      'type'      => 'float'),
                    array('longitude',  'length',    'max'       => 12),
                    array('longitude',  'numerical', 'precision' => 7),
                    array('postalCode', 'type',      'type'      => 'string'),
                    array('postalCode', 'length',    'max'       => 16),
                    array('street1',    'type',      'type'      => 'string'),
                    array('street1',    'length',    'max'       => 128),
                    array('street2',    'type',      'type'      => 'string'),
                    array('street2',    'length',    'max'       => 128),
                    array('state',      'type',      'type'      => 'string'),
                    array('state',      'length',    'max'       => 32),
                ),

Maybe in the wiki this argument should be insert.

Thank's again.

Guido






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users