Thursday, December 1, 2011

Make a form. Save yourself some time.

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.