Learning XPages Part 49 : Building The LocationsEdit XPage

This is going to be a very short section
as we have covered most of this material already in part 22 and 23 of the
series. In the last few section we created a special page for the phonebook
editor so that they could create, edit and delete location documents from
the web interface.

Back in the content_LocationAdmin custom
control we had created a view control. For the first column in the view
control we specified that the values should be displayed as links.

A picture named M2

and in the overall view control properties
we had specified that opened documents should use the ‘LocationEdit’ XPage.

A picture named M3

We created the LocationEdit XPage in
part 46 but left it pretty much blank, containing the custom controls for
the layout and a custom control called content_locationEdit for the main
content. In this part we are going to complete this custom control so go
ahead and open the content_LocationEdit custom control in your designer

The first thing we are going to need
is a data source so look at the main properties for the page and go to
the data section.  Add a new data source for a Notes Document and
give it the following values :

A picture named M4

Once we have added the data source you
can quickly create a table of labels and fields by using the data pane.
At the top of the controls pane on the right you should see the two down
arrows to switch to the data pane.

A picture named M5

You can now select all of the fields
available in the data source and drag them into your custom control.

A picture named M6

You can if you want revisit some of
the validation techniques that we covered in parts 33, 34 and 35 to add
some validation to this editbox controls on the form. An example could
be that you don’t want a location created with nothing in the ‘Location’

All that’s left to do for this XPage
is to create the buttons to save new or edited documents. I have again
elected to save myself some time and just copy the action bar and buttons
that I have created for other parts of the application. I have copied the
action bar and buttons from my content_Person custom control and then just
left in the ‘Save’ and ‘Cancel’ buttons.

Once you save the custom control and
preview editing a location in your web browser you should now see your
action buttons and the fields.

A picture named M7

Tagged with: , ,
Posted in None
%d bloggers like this: