Specifying "prompt values" and "help text" on an O4WTextbox (Web)
Created at 25 FEB 2013 02:47PM
Specifying "prompt values" and "help text" on an O4WTextbox
When you put up a textbox, it is possible to specify both a "prompt value" and "help text". The prompt value will appear in the textbox when there's no other value there - it is designed to help the user know what to put in. As soon as something is entered in the textbox, the prompt text will disappear. The help text will appear when the user "hovers" their cursor over the textbox, and might contain even more information for the user.
For example, let's say we have a textbox that's supposed to take the port number of the engine server:
O4WTextbox(value, "", "", "PORTNO" , "PORTNO")
We can put in, as the prompt, the default value - in this case, it shows the user what value we will use even if they leave it blank - and we can spell out in more detail what we are looking for in the help text. Our new code will look like this:
helpText = "Enter an available tcp/ip port for normal connection requests (default 8088)"
promptText = "8088"
O4WTextbox(value, "", "", "PORTNO", "PORTNO", O4WInputBoxOptions("number", "", "", "", promptText):O4WHelpStyle("", helpText))
We use O4WInputBoxOptions to specify the prompt, and O4WHelpStyle to specify the help text.
(Notice that we have specified, as parameter #1 to the O4WInputBoxOptions, "number" - this means we are telling the browser to expect a number, and different browsers might use this information in different ways. For example, some browsers on mobile phones will pop up a special numeric keyboard if they see this, while others might disallow any non-numeric entry.)
Note that the O4WHelpStyle can be applied to almost _anything_ - not just textboxes, but also items in a listbox, radio buttons, checkboxes, even plain text, headers, etc. Prompt text, only applies to textboxes.