Validation for minimum and maximum characters

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

harika gujjula created an issue. See original summary.

harika gujjula’s picture

Status: Active » Needs review
FileSize
1019 bytes

Validation check for minimum and maximum character length to be greater than 0.

krknth’s picture

Status: Needs review » Needs work

Can you combine two conditions ?

if ($max <= 0) {
  form_set_error('max-' . $type->type, t("Value should be greater than 0"));
}

and

 if ($max > 255) {
     form_set_error('max-' . $type->type, t("These value should be less than 256"));
   }
harika gujjula’s picture

Status: Needs work » Needs review
FileSize
1.12 KB
774 bytes

Added Patch and Interdiff

krknth’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Changing min, max labels 'length' to 'characters' will be more reasonable.

  • krknth committed aae1735 on 7.x-1.x authored by harika gujjula
    Issue #2625604 by harika gujjula, krknth: Validation for minimum and...
krknth’s picture

Status: Reviewed & tested by the community » Fixed

Thanks. changed label too.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.