diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-08-09 10:43:03 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-08-09 10:43:03 +0000 |
commit | db5311d144d067ae1774b5cf6b395c77ac209a6c (patch) | |
tree | c7600dc9dc2d0bdd395117dcfbe24676328b242a /includes | |
parent | 323fa356bd2137f873386191a061bdfaeffa7ae7 (diff) | |
download | brdo-db5311d144d067ae1774b5cf6b395c77ac209a6c.tar.gz brdo-db5311d144d067ae1774b5cf6b395c77ac209a6c.tar.bz2 |
#85208 by neclimdul and bjaspan (slightly modified): if no maxlength was specified, do not generate an empty HTML attribute
Diffstat (limited to 'includes')
-rw-r--r-- | includes/form.inc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/includes/form.inc b/includes/form.inc index 5ab3d885f..6001c51c8 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -1698,7 +1698,8 @@ function theme_token($element) { * A themed HTML string representing the textfield. */ function theme_textfield($element) { - $size = $element['#size'] ? ' size="'. $element['#size'] .'"' : ''; + $size = empty($element['#size']) ? '' : ' size="'. $element['#size'] .'"'; + $maxlength = empty($element['#maxlength']) ? '' : ' maxlength="'. $element['#maxlength'] .'"'; $class = array('form-text'); $extra = ''; $output = ''; @@ -1714,7 +1715,7 @@ function theme_textfield($element) { $output .= '<span class="field-prefix">'. $element['#field_prefix'] .'</span> '; } - $output .= '<input type="text" maxlength="'. $element['#maxlength'] .'" name="'. $element['#name'] .'" id="'. $element['#id'] .'" '. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />'; + $output .= '<input type="text"'. $maxlength .' name="'. $element['#name'] .'" id="'. $element['#id'] .'"'. $size .' value="'. check_plain($element['#value']) .'"'. drupal_attributes($element['#attributes']) .' />'; if (isset($element['#field_suffix'])) { $output .= ' <span class="field-suffix">'. $element['#field_suffix'] .'</span>'; |