Validating text box entries
You can work with your own User Form or download the demonstration or file.Note: Don't copy and paste the code from this web page, because some web-based characters will return errors.In addition to the “state” change, a pop-up appears.When the pop-up appears screen readers should read the contents of the pop-up.Only when the user selects a value from the available options does Word open the door and let the value in.Unfortunately, the user can still select the wrong item.The following code demonstrates a dynamic Validation Text Box that only accepts a 5 digit zip code after PM, and only accepts a county name before then.
Unfortunately, you can't verify that the entered ZIP code is the right ZIP code for a corresponding address.(Refer to Table A for form and control properties.) At the very least, you can parrot the user's input and ask for confirmation before committing the value to its purpose, giving the user the opportunity to fix typos.To expand the example, we'll also apply a business rule that requires both a first and last name.This code demonstrates a Validation Text Box that only accepts a 5 digit zip code.Validation Text Box also supports functions that generate regular expressions.