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 (Moderator: Dave Greenberg) »
  • Limit size of Address fields?
Pages: [1]

Author Topic: Limit size of Address fields?  (Read 1931 times)

paco verde

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
Limit size of Address fields?
February 08, 2008, 04:08:49 pm
The mailing house we use for sending out printed, i.e. hard copy, mailings has requested that we limit the size of our mailing list members' addresses to 45 characters per line. We are concerned that staff and/or volunteers will use more characters if more characters are possible.

Is there any way to limit the "Street Address" and "Addt'l Address 1" and "Addt'l Address 2" fields in CiviCRM to 45 characters?

What about just changing the defined field size in the database itself?
--
Thanks,

Glenn Gillis
ELAW U.S. Information Technology Manager
Environmental Law Alliance Worldwide
<http://www.elaw.org>

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Limit size of Address fields?
February 08, 2008, 07:01:32 pm
Glenn - Probably best way to do this is to create custom versions of the template files that display these fields. First check the info on customizing forms and screens here:

http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in+and+Profile+Screens

Then you'll use our crmReplace plugin to replace the existing maxlength attribute on these fields (which is maxlength="96") with the one you want...

You'll need to do this in 3 files:
civicrm/templates/CRM/Contact/Form/Address/street_address.tpl
civicrm/templates/CRM/Contact/Form/Address/supplemental_address_1.tpl
civicrm/templates/CRM/Contact/Form/Address/supplemental_address_2.tpl

In street_address.tpl - replace this:
Code: [Select]
{$form.location.$index.address.street_address.html}

with this:
Code: [Select]
{$form.location.$index.address.street_address.html|crmReplace:maxlength:45}

... and follow same pattern in other 2 files.
Protect your investment in CiviCRM by  becoming a Member!

paco verde

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
Re: Limit size of Address fields?
February 11, 2008, 02:15:56 pm
Quote from: Dave Greenberg on February 08, 2008, 07:01:32 pm
Then you'll use our crmReplace plugin to replace the existing maxlength attribute on these fields (which is maxlength="96") with the one you want...

Thanks for this info, Dave!

However, I'm having trouble locating the "crmReplace" plugin you mention; Google turns up practically nothing.
--
Glenn

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Limit size of Address fields?
February 11, 2008, 02:37:45 pm
Glen - it's built-in to the CiviCRM code-base. Just use the syntax I've shown above.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Limit size of Address fields?

This forum was archived on 2017-11-26.