How to Name Fields for Good Form Design
Who is this article for?Ideagen Smartforms users configuring the system.
Understanding of code is required.
When designing your form and setting the name of a field becomes an important first step because it potential determines how your field will be accessed later. Therefore, setting a field name that makes sense initially will reduce ambiguity and more work later. Here are some form design tips when field naming.
1. Name by field "groups" or "areas"
As you look at a form, most fields can be categorized into groups, usually based on where they are located in proximity to each other. For instance, a form
For instance, an area of your form might need to look like this:
In this case, the fields under "Buyer" should be grouped as the "Buyer" group; and fields under "Seller" should be grouped as the "Seller" group.
When naming fields for these groups, we recommend the following format:
Buyer | Seller |
---|---|
BuyerLabel | SellerLabel |
BuyerName | SellerName |
BuyerAddress | SellerAddress |
BuyerPhone | SellerPhone |
Note that the left-most text in the field name is the group and the right-most text is the field. You could continue to keep this formatting rule to identify field names such as the following if the above example required more detail:
Buyer | Seller |
---|---|
BuyerLabel | SellerLabel |
BuyerNameFirst | SellerNameFirst |
BuyerNameLast | SellerNameLast |
BuyerAddressStreet | SellerAddressStreet |
BuyerAddressCity | SellerAddressCity |
BuyerAddressZip | SellerAddressZip |
BuyerPhone | SellerPhone |
Naming fields in this format makes it very easy to identify what the field is referring to.
2. Handling sequential fields (such as checklists)
In some scenarios, a list of questions or checklists may need to be added, such as the following:
Note the hierarchy of groups and subgroups apparent on the form layout. Based upon this, following field naming might be ideal:
Labels | |
---|---|
StEngLabel | |
StEngActiveEngLabel | StEngStTalkLabel |
StEngActiveEngQ_1 | StEngStTalkQ_1 |
StEngActiveEngQ_2 | StEngStTalkQ_2 |
StEngActiveEngQ_3 | StEngStTalkQ_3 |
StEngActiveEngQ_4 | StEngStTalkQ_4 |
StEngActiveEngQ_5 | |
StEngActiveEngQ_6 | |
StEngActiveEngQ_7 | |
StEngActiveEngQ_8 |
In regards to aiding scripting and handling potential field calculations, consider reviewing How to Name Fields So That They Aid Scripting.
Naming fields in a logical, patterned method will help yourself and others later when exporting data and when maintaining your form for the future.
Happy form building!