FORMfields, the premiere web framework
Login
Support Home | Knowledge Base | Documentation | Forums | Contact Us
Info
FORMfields & FORMgen :: Formatting

Adjusting the Default Width of a Field Label

(3728 views. Last Updated: 2007-08-08 5:20 PM)

Unfortunately, each browser implements the max length of a CSS element differently. Therefore, we standardize label width by wrapping based on number of characters.

Here's how we can adjust the label width:
1. Patch the define statements (may not be needed in your version of FORMfields). Edit FORMfields/src/fields/FormField.php:
Replace:
define ("FORM_FIELD_FIELD_ERROR_WRAP", 20);
with:
FfGlobals::defineIfNotDefined ("FORM_FIELD_FIELD_ERROR_WRAP", 20);
and replace:
define ("FORM_FIELD_FIELD_LABEL_WRAP", 20);
with:
FfGlobals::defineIfNotDefined ("FORM_FIELD_FIELD_LABEL_WRAP", 20);

2. To globally adjust the label width to say 15 characters, edit FORMfields/src/fields/FormField.php and use:
FfGlobals::defineIfNotDefined ("FORM_FIELD_FIELD_ERROR_WRAP", 15);
FfGlobals::defineIfNotDefined ("FORM_FIELD_FIELD_LABEL_WRAP", 15);

Or, you can set the label width on a per form basis by adding:
define ("FORM_FIELD_FIELD_ERROR_WRAP", 15);
define ("FORM_FIELD_FIELD_LABEL_WRAP", 15);
to your form above the require statement that includes FORMfields.php.
Info
Support | Earn Money
Copyright © 2005-2019 Brain Book Software LLC.
Built with FORMfields, the premiere web framework.