Tech Tip: How to add a hint to an input field
PRODUCT: 4D | VERSION: 13.0 | PLATFORM: Mac & Win
Published On: June 8, 2012
The input field hint provides quick tips for fields which requires entering data in a specific format (for example email address, phone number, date / time, etc.) It is widely used in many Web application. However, the same feature can be implemented and used in 4D native form.
Here is an example of a form with input field hint:
1. Create an input variable object on a form and be sure to enable the On Load and On After Edit event for the object.
2. Create the object method for the created variable with the following code.
Case of : (Form event=On Load) Self->:="" OBJECT SET VISIBLE(*;"hintText";True) : (Form event=On After Edit) OBJECT SET VISIBLE(*;"hintText";(Get edited text="")) End case |
3. Create a static text object on the form and name it "hintText". Make sure the object is created on top of the variable object.
After the static text is moved on top of the variable
4. Change the font-color to light-grey and text to the desired hint.