I was wondering how I would go about disallowing character strings in text boxes.

Background: I've edited the signup_form.inc file to include a few more data fields - one of them happens to be an airport code field (i.e. the user is supposed to enter the 3 digit airport code that they are leaving from). The problem that I have is this: my users are too smart for their own good. A few of them have discovered that they can not enter more than 3 digits in that text box... so they don't enter their actual airport code, instead they enter AIR...

How would I go about flagging AIR as an invalid string?

Comments

dww’s picture

Status: Active » Closed (works as designed)

You could inject a custom validation function into the signup form via hook_form_alter() and do whatever validation you want in there. There are a bunch of resources online about the Drupal Form API, hook_form_alter(), validation callbacks, etc, but sadly, I don't have the bandwidth to walk you through all of that myself. Hope that helps!

Cheers,
-Derek