A McGraw Hill Book Plug-in PHP: 100 Power Solutions
By Robin Nixon (McGraw Hill 2010, ISBN 978-0071666596)

Home | About | Buy It | Download | Contact

Select Chapter: 1  2  3  4  5  6  7  8  9 10 11 12

Chapter 11: Plug-in 88 - Input Prompt

Sometimes you can make the life of your users easier when filling web forms by placing a prompt for what is required in the form field itself. Obviously you only want to do that when the field is blank, otherwise, if a field has a value then that's likely to be what the user wanted to enter. Using this plug-in, whenever you create a form <input> element you can specify such a prompt, and it will only appear when the field contains no input.

The Figure shows the plug-in being used to display the string "Required Field: Please enter your Username here" in a field where a user name is being requested.