![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Director Tutorials
To learn how to use the Form Designer to:
Before you begin See About exteNd Director Tutorials.
Prerequisites You must complete the exercises in Creating a Database Pageflow.
Before you get started You'll be working with forms that you generated when you did the Creating a Database Pageflow. You'll be working with the following forms:
You can open these forms in the Form Designer by:
Navigating to ExpressPortal-resource.spf\data\form directory (make sure you are viewing the ExpressPortal.spf file using source layout), then selecting the form and:
or
To specify a data type for a bind element:
Navigate to the Property Inspector (in the lower right pane).
TIP: Make sure you select the Output tab of the Property Inspector and not the Output (label) tab.
Change the Format property as follows:
Control name |
Format property value |
---|---|
hiredate |
dd/MM/yyyy |
Navigate to the Property Inspector (in the lower right pane) and make the following changes to the Format property:
Control name |
Format property value |
---|---|
salary |
CURRENCY |
Log in as a portal administrator or as a user, then click login or the Enter key.
The default page for the user you specified opens in your browser.
Click View to view a list of employee records for a department (for example, development).
Choose an employee (for example, Duke Ellington) and click View.
You will see the employee record with the salary and date formats that you applied.
You can experiment by changing the formats in the Form Designer, saving the changes, then clicking (Restart the current Pageflow).
To define an instance element as Required
In the Model tab, select the bind:nodeset=record/firstname element.
In the Add Model Item Properties dialog, select Required, then click OK.
In the Property Inspector, change the Required value to True().
Clear the First Name field and click Update.
The first time you do this, you are notified by a dialog that the data is invalid. When you clear the dialog, the field causing the problem is displayed in red. If you click Update again without correcting the problem, you'll see a second dialog indicating a submission error. These message actions are created by default when the forms are created. You can modify the messages in the Model tab of the Form Designer.
Open TutorialemployeesDetails.xhtml (located in the ExpressPortal project under ExpressPortal-resource.spf\data\form).
Click Edit class style rules. The Edit class styles dialog displays:
The Add new style dialog displays:
(Class name is a generated value, so the value in your dialog might be different.)
Accept the default class name and click OK.
Select the Type and Text tab and supply these values:
Property |
Value |
---|---|
Font family |
Arial, Helvetica, sans-serif |
Font size |
12 pt |
Font style |
italic |
Font weight |
bold |
You can see the changes when you run the form in Preview mode (clicking the XForms Preview tab in the Form Designer) or by running the form within the Pageflow.
To test the changes in the Pageflow:
Choose an employee and click View. You will see that the employeeid label looks different from the others like this:
In this exercise, you'll modify a generated form so that users can click a button to see label text in English or Danish. You'll learn how to:
Create a secondary instance data node for storing the translated label text.
Create dynamic labels that are bound to the secondary instance data.
Use the Event Editor to define an event handler and an XForms action.
Since you'll be changing the TutorialdepartmentsEdit.xhtml file, you might want to make a copy of it before you get started.
To create a secondary instance data node:
In the Model Editor, click on the root instance node, right mouse and choose Add Item.
Select the new instance element and navigate to the Property Inspector (the pane in the lower right corner of the Model tab).
Property Name |
Value |
---|---|
ID |
scratchpad (You'll be prompted to add a rewrite token. For this example, choose No, don't add the rewrite token.) |
Use pageflow data at runtime |
never |
Is inline |
checked (default) |
In the Instance Data Pane (upper right corner), select forms:instance (the document root for the scratchpad node). Right mouse and choose Edit>Insert New Element.
Complete the Insert New Element dialog as follows:
Field name |
Value |
---|---|
Name |
Department |
Namespace |
Do not supply a value. Leave it blank. |
Select Department (the node that you just created), right mouse-click and select Edit>Insert New Element.
Complete the Insert New Element dialog as follows:
Field name |
Value |
---|---|
Name |
name |
Namespace |
Do not supply a value. Leave it blank. |
Select name, right mouse-click and select Edit>Insert New Attribute.
Complete the dialog as follows:
Field name |
Value |
---|---|
Name |
value |
Value |
Department Name |
Namespace |
Leave this blank |
Repeat Step 10 through Step 15 to create a second name element with an attribute with the following values:
Field name |
Value |
---|---|
Name |
value |
Value |
Afdelingsnavn |
Namespace |
Leave this blank |
The completed scratchpad instance node should look like this:
To create Switch/Case statements:
Click the Insert XForms Switch icon from the control toolbar (the second to the last icon on the toolbar).
Click in the space above the existing layout region.
TIP: You'll see a pink arrow indicating where the control will be added.
You are prompted to define the case statements for the switch.
You are prompted to add the rewrite token. Choose Yes and click OK.
Copy departmentid and departmentname from the layout region and paste them into each Case layout region.
Delete the all of the controls except for Update and Cancel from the original layout region so that the final form looks like this:
Navigate to the Property Inspector and select the Input(label) tab.
Click the ellipsis next to the XPath of Reference property. The XPath Navigator dialog displays.
In the scratchpad instance node select name (the first element under Department), then select the attribute containing Department Name.
Navigate to the Property Inspector and select the Input(label) tab.
Click the ellipsis next to the XPath of Reference property. The XPath Navigator dialog displays.
In the scratchpad instance node select name (the second element under Department), then select the attribute containing Afdelingsnavn.
To create a DOMActivate event to toggle the Switch element:
Add two trigger controls to the newly created layout region.
TIP: The Insert XForms button icon represents the XForms trigger control.
Select the first trigger control and set the Label property to English.
Select the ellipsis next to the XPath of Reference property.
In the scratchpad instance node select name (the first element under the Department node).
Click to create a new event handler. The following dialog displays:
In the Event Editor, click and choose Toggle: select case in switch.
Select the second trigger control and set the Label property to Danish.
Select the ellipsis next to the XPath of Reference property.
In the scratchpad instance node select name (the second element in the Department node).
Click to create a new event handler. The following dialog displays:
In the Event Editor, click and choose Toggle: select case in switch.
TIP: Click XForms Preview tab to verify that the buttons and fields are bound properly. If any of the controls appear grayed out—then the bindings are not valid.
Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved. more ...