When a form is shown to the user on the web it is a good idea to let them know which fields are compulsory. The de facto way of doing this is to put an asterix (*) after the field label or to use red text for the label. Well, here is a method that not only looks a little better but is dynamic as well.
In the field below, the red circle is used to denote that the field is required.
This is achieved using a background image in the input box. Typically, this is only something that you can do in Internet Explorer. If, like me, you do most of your work on Intranets where the browser version is fixed, this is not a problem.
To do this to a field (called "TestField" in this example) add the following to its HTML Attribute:
@If(TestField=""; "class=\"RequiredField\""; "")
Your form then needs the following Style defined on it somewhere, before the fields, usually in the header:
.RequiredField {
background-image:url(/dbname.nsf/required.gif?OpenImageResource);
background-position:top right;
background-repeat:no-repeat;
}
How can we make this a little more dynamic? How about changing or removing the image once the field has been filled in (validated) ? Look at the form below that has four fields, three of which are required:
Your Detials
Note: A red circle denotes required fields and a green circle is for fields that are OK.
First Name: | |
Last Name: | |
Age: | |
Sex: |
Copyright © 2000 - 2024 Jake Howlett of Rockall Design ltd. This article was printed from codestore.net