« XPages in Pictures - 02 - Forms and Views | Main| XPages in Pictures - 04 - Saving an XPage and Misc. »

XPages in Pictures - 03 - First XPage

Category XPages
This is the third post in my series...

The first XPage we’re going to create will be used to display the Company documents.  

Create a new XPage and call it “xCompany”.

We want to bind this page to our company form.  This is a new concept.  In Traditional Notes Development the Form could only ever contain a single document.  You can reach into other documents with embedded views, dialog boxes or script but the rule is one document to a Form.  In XPages it’s possible to have multiple documents on a single XPage.  So we now have to deal with “Binding” which is telling an XPage or even individual “control” what document to work with.

For now we’re going to keep it simple and “Bind” 1 document to 1 XPage.


At the bottom, go to the Data section and click on Add:
A picture named M2

The default name will probably be “document1”.  Let’s change it to be “companyDoc”.  Choose “fCompany” for the form, and the default action can be “Create Document”.

A picture named M3
You now have an XPage that’s bound to the company form.  On the right hand side, there should be a Data Tab next to the controls tab.  This will show you the fields from the company form.

A picture named M4

Now, we need to select all the fields.  Click on the first item, “address1” then click on “zip” while holding down the shift key.  All the fields should be highlighted in blue.  Just drag them to the page.  It will put all the fields, with labels inside a table.

A picture named M5


How cool is that? Try doing that in a Notes Form! There’s even a cool Wizard that can help here.  I’ll talk about that later.  

For now, we want to change 2 things, the order of the fields, and the text of 2 labels.  Let’s do the labels first.

The labels are coming from the actual field names. DDE is automatically capitalized the first letter for you to try and help.  How thoughtful!  In the Form, there is only a single Address field, but I called it address1 in case we wanted another address field in the future.  You will want to change the label to just “Address:”.  Do this by clicking directly on the word “Address1”.  You should see the properties change at the bottom of DDE.  Change the label in the circled area to remove the “1”.

A picture named M6

Do the same thing with the label “Companyname”.  Rename that to be “Company”.

Your table should now look like this:
A picture named M7

Now you want to re-order these rows.  There are several ways this can be done.  You could do this in the Source view, or even with the outline panel.  I’m going to keep it simple here and work with the table like we might on a traditional Notes Form.

Click in the first row of the table to place your cursor.  Then click “Table – Add Row Above”.  This is available from the menus at the top, or the context menu that you get when you right click.

You should now have this:
A picture named M8
Carefully click on the label “Company:” and drag it to the top cell.  Do the same with the companyname edit box.

You get this:
A picture named M9
Now continue to re-arrange the order until it makes sense to you.  Move State up a row, Zip to where state was, and then you can delete the empty row where Zip used to be by using the option “Table – Delete Row”.

You now have a table that looks like this:
A picture named M10
Dragging controls from cell to cell in a table isn’t too difficult.  But you do need to be careful, as I’ve seen DDE get a little temperamental.  Arguably using the Outline view or the Source view might be a better way to do this but I’m trying to keep things simple and familiar.

Now would be a great time to mention something else Domino Designer in Eclipse (DDE) gives us.  Multiple levels of Undo!!!  So if you are dragging fields around and miss a placement, Edit-Undo (CTRL-Z) is your friend.  I don’t know how many levels it stores, but it’s a lot.  And guess what?  It’s not just for XPages!  Multiple Undo works in Forms and other design elements as well!

Ok, now it’s time to save the xCompany XPage and move on.  Don’t worry, we'll come back to this soon.

Comments

Gravatar Image1 - Nice work, David. I like this series.

Gravatar Image2 - Thanks for the comments! I should have the next article up on Monday. We'll be adding a home page to the application, see how to save the company page and have a little tangent on using @Unique in XPages vs the Client.


Gravatar Image3 - Great post David!

I need a tutorial like this to start. Thanks.

Emoticon

Gravatar Image4 - Thanks Rob!

Gravatar Image5 - David - good work! I'm in a very similar situation to you. I've done about 95% client work 5% browser. I have looked at XPages, but need to spend some time getting my head around the basics. I'm looking forward to the rest of the tutorials!

Gravatar Image6 - Mate! This is great, I agree that what is needed is a more of an "appetizer" tutorial, and this fits the bill perfectly. Keep it up, I'm loving it.

Gravatar Image7 - you know at first I was surprised (and quite amused:) to see this tutorial in pictures. it reminded me some manuals kids always get while trying to cope with a toy or lego. but then I realized that actually it's the same: we just use toys for adults. thank you for sharing this! it really helps.

Gravatar Image8 - Thanks for you good work.

Gravatar Image9 - I am happy to see these good documents.

Thanks !Emoticon !

Gravatar Image10 - Thanks for the work!! :)

Gravatar Image11 - nice work done

Gravatar Image12 - Useful tutorial, clearly written and good reminder about the multiple levels of undo - always handy I find.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Powered By:

Domino BlogSphere
Version 3.0.2