Do you need a form for an XPage? No. Can it makes things easier/faster for you? Yes. Here’s how.
I create simple unformatted forms for my documents because I often have the fields for a document spread across multiple custom controls. When I want to place the fields from the form into separate custom controls, I make Designer do the work for me.
I add the form as a data source to the custom control, drag the fields in that I need, then remove the data source from the custom control. If I need to heavily manipulate fields in an existing custom control, I add the data source back in to do my work and then remove it when I am done.
Of course, the actual data source exists in the host XPage (or custom control).
- Do I need a form? No.
- Could I just type the bindings and other attributes into the source? Yes.
- Is there a problem if I do not remove the duplicate data source from the custom control? Yes. (Don’t forget to remove the duplicate data source.)
- Does it save time? Yes for me.
A lot of time at the beginning, a lot of time when I am editing the fields on the custom controls because the chances for error are greatly reduced and a lot of time when it totally eliminates Designer’s annoying habit of erasing an entire binding in the source after you type a single character.
- Do I use the form other things? Yes.
Most of the applications I write end up having 50+ fields on a document. I sometimes use the form as the documentation mechanism for those fields. It forces me to make sure I have all of the fields I am using in the application documented somewhere. Well, I try anyway.
Great Tip! I do this all the time with forms, what I would really love to see is the ability to pick a Java Bean and drag and drop to create the field bindings like this.
I just taught an XPage class to my client's development staff and suggested that they set a policy to develop the form as they build their XPages. I suggested that they use it as a documentation tool, create a table and set it up to allow them to enter any special validation rules, default values, formulas, etc. This makes it easier for anyone to step in and figure out what was going on when the app was originally built.
@Toby Thanks! Drag and drop bean binding would be awesome. Maybe it's "in there" and we just don't know!
@Roy I think it is a good policy. Like people say…documentation is for the next person, not really for you.