If you would like to use script in your forms in order to automatically flag mandatory fields, using a red asterisk (*) in their captions, check-out this article I just posted on my blog.
The script supports mandatory fields with the following characteristics:
- have plain or rich text captions
- have no captions (no asterisk is displayed in this case)
- use text objects (plain or rich text) as captions instead of normal field captions
- have the same name (multiple instances that aren’t dynamically generated)
- are inside repeating subform instances
Typically called when the root subform is initialized, the script will search recursively (depth-first search) for all fields within a specified container (i.e. the root subform) and will place the asterisk on any mandatory field it finds. There is also a function by which the asterisk can be toggled on/off by explicitly telling the function whether to treat the field as mandatory or optional.
The script is located in a script object. The idea is that you would make a script object fragment out of it and re-use it in any form that needs this functionality. The script is also heavily commented so it should be relatively easy to extend for your own needs.