Pageflow and Form Guide

CHAPTER 6

Form Designer

This chapter introduces the Novell exteNd Director Form Designer and describes how to use it to create and modify XForms 1.0-compliant Web forms. It includes these sections:

 
Top of page

About XForms

XForms provide a robust, standards-based way to define Web forms. The advantages of the XForms standard include:

XForms cannot run as standalone applications. They are designed to run as components within a host language like XHTML. In Novell's implementation, they run within the context of a pageflow application.

 
Top of page

About the Form Designer

The Form Designer provides a graphical environment for developing XForms 1.0-compliant Web forms.

The Form Designer is divided into these tabs:

Tab

Description

Form

Lets you define the form's user interface. You can graphically:

  • Lay out and style form controls

  • Bind form controls to data

  • Define events and actions for form controls

For more information    For more information, see Defining the presentation.

Model

Lets you define the form's model elements. You can:

  • Create and edit models

  • Create and edit instance data

  • Set up data constraints

For more information    For more information, see Working with model elements.

Source

Launches a powerful XML source editor.

For more information    For more information on working using the XML Editor, see the chapter on the XML Editor in Utility Tools.

XForms Preview

Lets you run a form in test mode.

For more information    For more information, see Testing forms.

 
Top of page

Starting and stopping the Form Designer

To start the Form Designer, you:

Procedure To open an existing form:

  1. Select File>Open.

  2. Navigate to the location of the existing form (usually in the project's \data\form directory).

  3. Click the form file and choose Open. (Optionally, you can double-click the form.)

 
Top of page

Creating forms

You use the Form Wizard to create either an initial unbound form or a data-bound form based on:

Other strategies   To create a complete pageflow including input and output forms from any other source, you'll launch a different wizard. For more information on launching other wizards that generate XForms within the scope of a pageflow application, see Database Pageflow Wizard, Web Service Pageflow Wizard, and Composer Pageflow Wizard.

Procedure To create a form using the Form Wizard:

  1. Open an exteNd Director project.

    TIP:   You can't start the Form Wizard unless you have a project that contains a resource set open.

  2. Select File>New.

  3. On the Portlet tab, choose Form and click OK. (Alternatively, you can double-click Form.)

    The first panel of the Form Wizard displays:

    frmWizardName

  4. Specify the following options:

    Option

    What to do

    Form name

    Specify a name for the form. You don't need to specify any extension.

    Use CSS layout

    Check this box when you want the wizard to use absolute positioning to layout the controls on the form, otherwise, uncheck this box.

    If you choose not to use CSS layout, absolute positioning is not available.

    For more information    For more information about how the wizard uses CSS layout, see About the wizard-generated forms.

    Standard portlet CSS classes

    Check this box when you want the wizard to use the WSRP CSS classes for fonts and colors. (The defaults are defined in the wsrp-classifications.xml file located in the Common\Resources\CSSClassifications directory).

    When checked, these classes are used in combination with the portal theme files at runtime for styling the page.

    Uncheck this box if you want to define your own colors and fonts.

  5. Click Next to proceed.

    The following wizard panel displays:

    .frmWizardSource

  6. Specify one of the following file types for your initial instance data:

    Option

    What to do

    Schema

    Choose this option if you want the wizard to generate controls that are bound to the instance data nodes created from the elements of an existing schema.

    The schema type of each instance data node is automatically specified.

    Sample XML data

    Choose this option if you want the wizard to generate controls that are bound to instance data nodes.

    If you want to specify formatting for the displayed data values, you will have to add schema type information manually.

    No initial instance data

    Choose this option to create XForms with no data-bound controls.

    Specify a file

    Specify the name and location of the file containing the schema or the sample XML data:

    • Browse—Choose this option when the file is located on disk.

    • Resource Set—Choose this option when the file is located in a resource set within the currently open project.

    If you chose Schema, you are prompted to specify the root of the instance data defined by this schema on the next pane:

    1. Choose the root from the list supplied in the dropdown list.

    2. Click Next.

  7. Click Next.

    The following wizard panel displays:

    frmWizardFormatting

  8. Specify the following options:

    Option

    What to do

    Specify the number of columns for this page

    Specify how many columns of controls the wizard should generate.

    Specify how to align the labels relative to the controls

    Specify how the labels and the controls should be aligned.

    Specify the width for each column

    Specify the width and unit for each column.

    The wizard converts the units to pixels.

    Specify the font size that will be used in the browser

    Specify the font size and units to be used.

    Specify the gap between rows

    Specify the amount of space (in pixels) between rows.

    Specify the vertical gap between the label and its control

    Specify the amount of space (in pixels) between the label and control.

  9. Click Finish.

  10. When the wizard reports that it has finished creating the form, click OK.

What happens   When you click Finish, the Form Wizard generates an XHTML file including all of the markup necessary to:

 
Top of section

About the wizard-generated forms

The generated forms are XForms 1.0-compliant. They reside in an XHTML file. Each form generated by the wizard has the following:

XML namespace declarations

XML namespace declarations are located at the top of the file and have this format:

  xmlns:xforms="http://www.w3.org/2002/xforms"

XML namespaces identify the XML language an element belongs to—and how to process them. Some example prefixes include:

xmlns prefix

Description

xforms

Treated as XForms language elements

ev

Treated as XML event language elements

What you do   You are not required to change the wizard-added namespaces. You may have to add new namespace declarations depending on your application.

XForms model element

The XForms model element is located within the <head> of the XHTML document. The model element defines the:

In the wizard-generated model element you'll see an id attribute with a name that includes _wsrp_rewrite_—like this:

  <xforms:model
     id="model1_wsrp_rewrite_">

A model ID is not required (unless there are multiple models); however, the Form Wizard always generates a model ID. The wizard-generated model ID always includes the wsrp_rewrite token. At runtime the wsrp_rewrite token is replaced with a unique name. This allows the runtime environment to manage multiple forms and models running within a single page.

What you do   You'll use the Model tab to define instance data, submission elements, and model item properties. The runtime environment will manage the replacement of the wsrp_rewrite token.

XForms:action elements

Within the model element, you'll see two predefined XForms <action> elements containing two XForms event handlers. They are default handlers for submit and data validation errors.

They provide user feedback when an error occurs on submission. They are intended to ensure that there are no silent failures for your form. They look like this:

  <xforms:action ev:event="xforms-invalid" ev:observer="div_wsrp_rewrite_">
  <xforms:message level="modal">The data is invalid. Please check it    and try again.</xforms:message>
  </xforms:action>
  
  <xforms:action ev:event="xforms-submit-error">
  <xforms:message level="modal">Submission error. Please check the
     data and try again.</xforms:message>
  </xforms:action>

What you do   No action is required, but you can modify them or remove them if you do not want your form to include this functionality.

<style> element

The <style> element contains the CSS definitions for the form and controls.

If you choose to use CSS layout (when generating the form), the styling information for the generated page is contained in CSS styling rules located in a <style> element within the <head> of the XHTML file. You can also store the CSS style rules in an external file referenced from the XHTML file through a link.

NOTE:   If you specified not to use CSS styling (when generating the form via the wizard), the generated form will not contain a style node.

The following applies to all XForms controls on a form:

Each control...

Details

Resides in a layout region

A layout region is a container for the XForms controls on an XHTML page. It allows you to position controls more precisely.

  • All layout regions must have the same width. The layout region is defined by a single selector on the form. The selector is:

      nv-block-width_wsrp_rewrite_ 
    

Each layout region has an individual rule to define height.

Is assigned a class attribute beginning with .nvP followed by a number

The numbers are assigned sequentially.

Each control name also contains the token _wsrp_rewrite_ . The token is replaced at runtime and is used to ensure uniqueness of control names when more than one form resides in a single page.

Is styled according to the CSS box model and the CSS pseudo element :: value

There are three types of controls—

  • Controls with no label, like <repeat>

  • Controls with an integral label, like <trigger>

  • Controls whose labels can be positioned separately from the text field, like <input>

Controls with an integral label are given one selector. For example:

  .nvP4_wsrp_rewrite_ {
  	 position : absolute;
  	 left : 10px;
  	 top : 91px;
  	 width : 67px;
  	 height : 25px;

Controls with separate labels are given three selectors. For example:

  • One for a wrapper:

      .nvP1_wsrp_rewrite_ {
      	 display : block;
      }
    
  • One for the control's label:

      .nvP1_wsrp_rewrite_ xforms|label {
      	 display : block;
      	 position : absolute;
      	 left : 10px;
      	 top : 1px;
      	 width : 73px;
      	 height : 20px;
      }
    
  • One for the data area of the control:

      .nvP1_wsrp_rewrite_::value {
      	 display : block;
      	 position : absolute;
      	 left : 88px;
      	 top : 1px;
      	 width : 88px;
      	 height : 20px;
    

What you do   You can modify the default CSS styling rules by:

For more information    For more information, see Using the CSS Style Manager.

 
Top of section

Saving forms

Procedure To save a form:

 
Top of page

Defining the presentation

The Form tab provides the tools to define the user interface. This section describes how to use the Form tab. It includes these topics:

 
Top of section

About the Form tab

The Form tab provides a graphical way to create and manipulate the form controls that make up the user interface. The Form tab looks like this:

FormDesignerMainPanes

The Form tab provides:

Tool

Description

Visual Editor

Use the Visual Editor to graphically create and manipulate the controls. The editor includes a tabbed toolbar that includes:

  • XForms toolbar—the set of controls and blocks that you can drop on your form.

  • Align/Distribute toolbar—allows you to change the way selected controls are aligned (left/right) or distributed (vertically/horizontally).

Instance Data Pane

Use the Instance Data Pane to bind instance nodes to form controls.

You cannot use the Instance Data Pane (in the Form tab) to modify the structure of the instance data. Use the Instance Data Pane in the Model tab for those types of functions.

Property Inspector

Use the Property Inspector to manipulate the CSS and data binding properties on the currently selected control.

For more information    For more information on using the Property Inspector, see Setting form control properties.

Event Editor

Use the Event Editor to define the events and actions for controls on the form.

For more information    For more information, see Working with model elements.

Form tab limitations

Only the form controls in layout regions on the page are editable. You cannot use the Visual Editor to edit the XHTML on the page. The XHTML tags are not expanded to display their content—only the tags are displayed. You cannot insert a form control into an XHTML tag.

 
Top of section

Shortcut keys

You can use the following shortcut keys in the Visual Editor:

Keystroke

Description

Ctrl-X

Cut

Ctrl-C

Copy

Ctrl-V

Paste

Delete

Delete

Arrow keys (left, right, up, down)

Moves the selected object 5 pixels in the corresponding direction

Ctrl-arrow key (for example, Ctrl-right arrow)

Moves the selected objects 1 pixel in the corresponding direction

Shift-arrow key (for example, Shift-right arrow)

Stretches the selected object 5 pixels in the corresponding direction

Ctrl-Shift-arrow key (for example, Ctrl-Shift-right arrow)

Stretches the selected objects 1 pixel in the corresponding direction

 
Top of section

About form controls

The Form Designer supports all of the XForms controls outlined in the XForms 1.0 specification and several other controls used by the Form Designer to control formatting. The controls include:

Icon

Control

Description

frmButtonControl

XForms trigger control

A standard XForms trigger control. For example, a button on a form.

Allows user-triggered actions.

XFormsTriggerStyledLink

XForms trigger styled as a link

A standard XForms trigger control preconfigured to emulate a link. CSS rules are applied to make the trigger look like a link not a button.

This means that:

  • The trigger contains an <xforms:action> event handler that listens for the DOMActivate event (button press).

  • The action element contains an <xforms:load> element that loads a new page via an HTTP GET operation. Use the control's property sheet to specify the URL to use for the GET.

For more information    See also Emulate link, Style as link, Request type, Target URL, Submission in the section on Setting form control properties.

frmOutputControl

XForms output

Displays read-only data to the user.

This control supports the format property which allows you to specify formatting for certain data types. You apply the formatting in the Property Inspector .

frmTextAreaControl

XForms text area

Allows users to enter freeform, multiline content.

frmUploadControl

XForms upload control

Allows users to upload a file from the local file system.

IMPORTANT:   The instance node to which the upload control is bound must be defined as a schema type of base64Binary or you will encounter inconsistent behavior at runtime. For example:

  <lastname xsi:type="xsd:base64Binary"/>

frmInputControl

XForms input

Allows users to enter single-line freeform data.

This control supports the format property which allows you to specify formatting for certain data types. You apply the formatting in the Property Inspector .

For more information    For more information, see Format.

frmRangeControl

XForms range

Allows users to select from a sequential range of values.

frmSecretControl

XForms secret

Allows users to enter single-line freeform data. The characters are disguised during data entry. Useful for things like passwords.

frmSelect1Control

XForms Select One

Allows users to select a single item from a set of choices.

frmSelectMany

XForms Select Many

Allows users to make more than one selection from a set of choices.

frmSubmitControl

XForms submit button

A special form of trigger that allows users to submit the contents of the form.

frmXHTMLImageControl

XHTML image

Displays an XHTML image loaded from the project's resource set. Visible in the Form tab, and View form in browser modes.

frmHTMLContentBoxControl

HTML content box

Read-only display of static HTML content.

frmAbsPosControl

Absolute positioning region

exteNd Director extension. Used for managing layout.

frmRepeatControl

XForms repeat

Use to display collections of homogeneous data.

To manage the repeated elements, add a repeat block to the form, then add the controls representing a single instance of the repeated data within the repeat block.

At runtime the processor renders the repeat block once for each data element that the repeat control is bound to. Each instance of the repeated data is processed as a block. Each block is placed below the preceding block. All of the remaining, nonrepetitive content is placed below that.

You cannot directly position nonrepeated objects :

  • Below the repeated elements within the repeat block

  • To the right of the repeated elements within the repeat block

frmSwitchControl

XForms switch

Use to perform conditional processing of controls on the form.

The switch element allows any number of case elements as children. Each case represents a subform, exactly one of which is rendered at any time by the runtime processor. The case rendered is determined by an action in an event handler not based on the result of a calculation.

The Form Designer represents switch elements as a layout region for each case element.

You cannot specify the order of the case statements within a switch block—but that is not necessary, since only one will be displayed at a time. The event handler determines how cases are displayed in response to the events that you specify.

frmPageflowlinkRegion

Pageflow link region

exteNd Director extension.

At runtime this control is replaced with one or more submit buttons.

For more information    For more information, see Button link.

For more information    For more information on the properties that you can specify for the controls, see Setting form control properties.

 
Top of section

Manipulating controls

After you generate an initial form using the Form Wizard, you can refine it by adding or moving controls. You can use the Form tab for:

Adding and removing controls

Adding controls

Procedure To add unbound controls from XForms toolbar:

  1. Click on the control type in the toolbar.

  2. Click within the layout area to place the upper-left corner of the control on the form.

Procedure To add unbound controls from the Form Designer menu:

  1. Select Form Designer>Insert.

  2. Select the control from the popup menu.

  3. Click within the layout area to place the upper-left corner of the control on the form.

Removing controls

You cannot remove a control without also removing its label.

Procedure To remove a control:

  1. Click the control.

  2. Press the Delete key.

    OR

  3. Select Edit>Cut.

Moving controls

Procedure To move a control:

  1. Click the control.

  2. Drag it (or use the arrow keys to move it) to the new location.

Procedure To move more than one control:

  1. Select the controls to move by:

  2. Drag the set of controls to the new location.

Sizing controls

By default, a control's width and height are unspecified so that they can automatically adjust to their content. You can specify an exact width and height in the two ways described below

NOTE:   When you define the width and height, the contents of the control wrap to to accommodate the specified size. The runtime results are not guaranteed.

Procedure To size a form control graphically:

  1. Click the control so that the handles are visible.

  2. Size the control by:

Procedure To size a form control using the Property Inspector:

  1. Select the control.

  2. Open the Property Inspector and specify the width and height for the control.

Aligning controls

You can align controls within a layout, repeat, or switch block.

Procedure To align controls:

  1. Select the control to use as a reference, plus the additional controls that you want to align with it.

  2. Choose the alignment you want (from the Align toolbar) to apply to the selected objects.

    OR

  3. Choose Form Designer>Align Distribute selected objects.

Grouping and ungrouping controls

You may want to create groups of controls, because a group can:

Rules for grouping controls

Most of these rules are required because of the hierarchical nature of XML.

Procedure To create a group:

  1. Select the controls you want to group.

  2. Select Add to Group from the Form Designer menu or by right-clicking and selecting it from the popup menu.

  3. Choose New Group.

  4. Enter a name for the group.

    The Form Designer creates the new group, and it becomes the current selection. The Property Inspector displays properties for the selected group. When the group is selected, it can be dragged around the page to reposition the controls within the group.

What happens when you group controls

When you create a group:

Procedure To add a control to a group:

  1. Select the control to add.

  2. Select Form Designer>Group>Add to Group (or right-click to display a popup menu).

  3. Select the name of the group to add the control to.

    The selection does not change to the entire group, in case there are additional commands to be performed on the selected control. The XML element for the control is moved under the group element representing the group, and the instance data binding XPath is adjusted to be relative to the node bound to the group element.

Procedure To remove controls from a group:

  1. Select the control(s) to remove.

  2. Right-click and select Remove from group (or select it from the Form Designer menu).

  3. Choose the group from which the element should be removed.

    The XML element(s) representing the control(s) are detached from the group element and made siblings of it; the instance data XPath expressions are adjusted to absolute expressions. If no controls remain in the group, the group element is removed from the document.

Procedure To remove a group:

What happens when you remove a group

When you remove a group:

 
Top of section

Applying styles to controls

The Form Designer provides default styles (based on standard portlet CSS class definitions) to implement color, sizing, and fonts used in the form's presentation. The default class attributes for the styles are defined in wsrp-classification.xml (located in the \Common\Resources\CSSClassifications directory). At runtime, the various portal theme files define the styles associated with these class attributes, and with some internal Novell class attributes.

Changing CSS Classifications

The wizard generates class attributes for each of the controls on a form. For example, an input field on a form could be given a name like:

  class="nvP1_wsrp_rewrite_ portlet-form-input-field"

These classes are defined in WSRP-classification.xml in the Common\Resources\CSSClassifications directory. This file maps the class names to particular control types. These class names are added by the wizard if you check the Standard Portlet CSS Classes check box (on the first page of the wizard).

Procedure To apply CSS Classifications to a file that was not generated with these values:

  1. Open the form in the Form tab.

  2. Choose Form Designer>Set CSS Classification.

    The Apply CSS classifications dialog displays:

    frmApplyCSSClassification

  3. Complete the panel as follows:

    Field

    Description

    Select the set(s) of classifications to be applied to this document

    You must select WSRP.

    NOTE:   Further sets of classifications may be made available in the future.

    Apply new class values to existing controls

    Check this box to have the new class values added to existing controls, as well as to new controls that get created later.

    Remove old class values from existing controls

    Check this box to strip all of the classification-defined class values from the controls on the form.

    For example, a control with the attributes:

      class="nvP1_wsrp_rewrite_ portlet-form-input-field"
    

    will become:

      class="nvP1_wsrp_rewrite_ " 
    

    If you check this box, you will lose any formatting associated with the class values that were removed.

  4. Click OK.

Using the CSS Style Manager

You can use the CSS Style Manager to edit any internal or external CSS style sheets associated with your form from within the Form Designer. You can use it to specify CSS properties like background color, text color, and font size associated with specific controls and labels. (The Form Designer directly handles control and label positioning; you cannot use the CSS Style Manager for this function.)

Procedure To open the CSS Style Manager:

  1. With a form open, choose Form Designer>Style Manager.

    FormDesignerStyleManager

NOTE:   Pressing cancel on this main dialog does not cancel completed actions.

You'll use the CSS Editor to create, edit, and delete style rules for both internal and external style sheets.

For more information    For more information, see the chapter on the CSS Editor in Utility Tools.

 
Top of section

Working with layout regions

To allow you more precise control of the layout of the controls on a form, the Form Designer requires you to place form controls within a layout region. A layout region is a container for the XForms controls within an XHTML page. Like other form controls, you can add, remove, size, and set properties on layout regions. The following controls can act as layout regions:

Layout regions are identified with a gutter in the far left of the Visual Editor. :

frmLayoutGutter

Click the gutter to select the control for setting layout region properties, resizing, or deleting.

Procedure To add a layout region to a form:

  1. Choose the layout control to add from the XForms toolbar.

  2. Position the cursor to the location where you want to add the control.

    The cursor displays as a pink arrow.

    PinkArrow

  3. Click to place the layout region.

    The layout region is added to the form.

Procedure To remove a layout region:

  1. Select the layout region (it is selected when the gutter label is highlighted).

  2. Right-click and choose Delete.

Procedure To resize a layout region:

  1. Select the layout region to resize.

  2. Grab the handles of the layout region and drag the box to the required size.

Procedure To create nested repeat blocks:

Procedure To create a switch block:

  1. Click the Insert XForms Switch icon in the XForms toolbar.

  2. Move the pointer to the white space at the bottom of the bottommost block.

    The Add New Cases to Switch dialog displays.

  3. Enter two or more case IDs separated by spaces.

    You'll use the case IDs to program the behavior in the Event Editor.

  4. Click OK.

    The The Form Designer adds a switch block with a case block for each case id you entered.

  5. Add controls to the case layout regions, as described in Adding and removing controls.

TIP:   You can add or remove cases by selecting the switch box, right-clicking and choosing the action from the popup menu.

Setting form control properties

Properties are attributes that you can set at design time for a particular control. You specify property values in the Property Inspector. See the table below for properties specific to the exteNd Director extensions (such as the Pageflow link region) or conveniences (such as the Alert literal text). For all other definitions, see the XForms specification.

Property name

Description

Applies to

Alert literal text

The text displayed in an alert box.

For more information    See Informing users of validation errors

All controls for which model item properties can be defined

Button height

Specifies the height of buttons added to the Pageflow link region at runtime.

The default is 25.

Pageflow link region

Button layout

Specifies the layout of the buttons added to the Pageflow link region at runtime.

The default is Horizontal.

Pageflow link region

Button spacing

Specifies the spacing between the buttons added to the Pageflow link region at runtime.

The default is 5 pixels.

Pageflow link region

Button width

Specifies the width of the buttons added to the Pageflow link region at runtime.

Pageflow link region

Dynamic choices

For more information    See Populating the Select controls

XForms Select Many

Edit class style rules

Launches a dialog that lets you:

  • Modify the CSS class styles on the currently selected control

  • Create new or edit existing styles (by launching the CSS Editor)

All controls for which CSS styling applies

Emulate link

Defines a trigger control's appearance.

Checked—Trigger is styled as a link. Adds an <xforms:action> event handler that listens for the DOMActivate event (button press). The action element contains an <xforms:load> element that loads a new page via an HTTP GET operation (and thus the Request type is set to Get).

There is no default URL to use for the GET; you have to add that via Target URL.

UnChecked—Trigger is styled as a button.

XForms trigger control, XForms trigger styled as a link, Pageflow link region

Field type

Sets the data type that the control assumes for the instance item it is bound to.

Use this in conjunction with the Format property.

Make sure that you specify a field type that is valid for the data type of the field. When there is a conflict between these two types:

  • The instance node the form control is bound to becomes invalid.

  • The event xforms-invalid is dispatched to form controls bound to that node.

  • The form control becomes invalid and thus the CSS styles with the :invalid pseudoclass apply.

  • If the invalid instance node is part of the document fragment being submitted, the submit fails.

See also Format

All controls that can be bound to data

Format

Specifies how to format the data when displaying it.

Valid formats are:

Number, currency, percent, ###,###.##, #####0.##, #####.00

See also Field type

All controls that can be bound to data

Hint literal text

The text displayed in a tooltip.

All visible controls

ID

A unique identifier for the control.

All controls

Label

The text displayed for the control's label.

All controls that can have a label

Model ID

The ID of the model associated with the Form control.

All controls that can be data bound.

Request type

Get—Uses the <xforms:load> action. Requires a Target URL property.

Post—Uses the <xforms:send> action. Requires a Submission property.

XForms trigger control, XForms trigger styled as a link, Pageflow link region

Source

Specifies the name of the source file containing the XHTML image to insert.

XHTML image

Style as link

Checked—The XForms Trigger control is styled as an HTML link.

Adds a CSS class selector (nv-link-style) to the trigger's class attribute. This CSS selector styles the trigger to look like the default appearance of the HTML <a> tag. This selector rule is added to the page's <style> node so you can modify it to look the way you want.

All triggers marked to emulate links share this same style.

Unchecked—Removes the selector name from the trigger's class attribute, but does not delete the selector rule from the <style> node.

XForms trigger control, XForms trigger styled as a link, Pageflow link region

Submission

Specifies the value of <xforms:send>'s submission attribute. (This is the ID of an <xforms:submission> in the <xforms:model>.)

XForms trigger control, XForms trigger styled as a link, Pageflow link region

Target URL

Specifies the value of <xforms:load>'s resource attribute.

(The URL that a GET is sent to in order to load the new page.)

This URL automatically gets marked up for URL rewriting in the portlet context, so specifying a relative URL here will get back to your portlet.)

XForms trigger control, XForms trigger styled as a link, Pageflow link region

 
Top of section

Binding controls to data

The Form Designer makes it easy to bind controls to a single node or a node set. In many cases you won't need to take any action to bind a control to data. For example:

If you want to modify the generated bindings, or if you want to bind controls that you've added to the form from the toolbar, you can use the Property Inspector to specify the binding attributes. You can also set up a <bind> in the Model tab, then set the bind property to the <bind> element's ID. See Binding elements to controls.

NOTE:   The following procedure generates a binding via a <ref> attribute on the control. It's possible to specify either a <ref> or a <bind>. When you specify one, the Form Designer removes the other. If you enter both via the Source tab, the <bind> takes precedence.

Procedure To bind a control to a single node via an XPath:

  1. In the Visual Editor, select the control you want to bind.

  2. Using the Property Inspector, specify the model ID (when there is more than one model element for the form).

  3. Specify the XPath by:

Procedure To bind a control to a node set:

NOTE:   <repeat> elements require that you bind to a node set.

  1. In the Visual Editor, select the control you want to bind.

  2. Using the Property Inspector, specify the model ID.

    1. In the XPath Navigator dialog, locate the node you want to bind to and select it.

      For more information    For more information on using the XPath Navigator, see the chapter on scoped paths and XPaths in Developing exteNd Director Applications.

    2. Click OK to return to the Form Designer.

    NOTE:   If a <ref> resolves to multiple nodes, the first node is used.

Populating the Select controls

There are two ways to provide a list of values for the Select controls:

Method

Enables you to

When to use

Statically

Specify the list values while you are designing your form.

Use this method when the list is relatively short, you know what the values are, and the values won't change.

Dynamically

Specify the list values come from a nodeset.

Use this method when the information is located in an XML file.

When you do not know what the list items will be or the list changes frequently.

List values   Lists have two types of values:

The user sees the label, but the associated value is the value written to the instance node. This allows you to display user-recognizable text while storing keys or other types of codes in the instance node. For example, if you entered the words apples, oranges, and pears, these words would appear in the display list. However, selecting apples might return the value 1, oranges could return 2, and so on.

Instance elements   A Select control is usually associated with two instance elements:

Procedure To load the list statically:

  1. Highlight the Select control and access the property sheet.

  2. Choose the Edit Select Choices link.

    The Select Control Choices dialog displays.

    pfSelectStaticChoices

  3. Click the Static Choices radio button.

  4. The dialog enables the Label and Value text boxes:

  5. When you are done, click OK.

Procedure To load the list dynamically:

  1. Highlight the Select control and access its property sheet.

  2. Choose the Edit Select Choices link.

    The Select Control Choices dialog displays:

    pfSelectDynamicChoices

  3. Click the Dynamic choices radio button.

  4. Choose the model from the dropdown list box.

  5. Click the ellipsis next to the Nodeset XPath to access the XPath Navigator to choose a nodeset.

  6. Click the ellipsis beside Label XPath to access the XPath Navigator to the display value.

  7. Click the ellipsis beside the Value XPath to access the XPath Navigator to choose storage value. This value is written to the instance node.

  8. When you are done, click OK.

 
Top of page

Working with model elements

The XForms model element defines the structure of the XML data available to the form. It defines the:

The Model tab includes these elements:

Element

Description

For more information, see

Model

The model root

Specifying model elements

instance

Points to or contains the data used to initialize the form

Specifying instance elements

action

Defines event handlers and actions that can be accessed from any part of the form

Specifying actions

submission

Defines the set of data to submit and how to submit it

Specifying submission elements

bind

Defines properties (called model item properties) of the instance data—like readonly, relevant, calculations, and indirect binding, and so on

Specifying Bind elements

 
Top of section

About the Model tab

The Model tab provides a graphical way to define the elements that comprise the form's model. The Model tab looks like this:

frmModelPane

The Model tab provides:

Tool

Description

Model Editor

Use to add and remove elements.

Instance Data Pane

Use the Instance Data Pane to modify the structure of the instance data.

For more information    For more information on using this tool, see XML Editor in the online Utility Tools.

Property Inspector

Use to create and modify attributes on the selected model element.

Event Editor

Use to define the events and actions on the selected model element.

 
Top of section

Specifying model elements

By default, the wizard-generated forms include a model.

Procedure To add a model element:

  1. With the form open in the Model tab, click Add (at the top of the Model Editor).

    The following dialog is displayed.

    frmModelNew

    You'll see that wsrp_rewrite_ is appended to the model ID name. This is a placeholder that is recommended. At runtime the wsrp_rewrite_ is replaced with a unique ID to ensure that no naming conflicts occur among other forms or portlets on the same page.

  2. Name the model and click OK.

    The Form Designer creates a new, empty model tree and displays it in the Model Editor.

Procedure To remove a model element:

  1. With the form open in the Model tab, select the model element you want to delete from the dropdown list box.

    frmModelSelect

  2. Click Delete.

Procedure Specifying model properties:

  1. Select the model in the Model Editor.

  2. Access the Property Inspector and complete the properties as follows:

    Property

    Description

    ID

    Specifies a unique identifier for a model.

    A model ID is not required (unless there are multiple models), but the Form Wizard always generates a model ID and uses the token wsrp_rewrite. It is good practice to use an ID because at runtime there might be multiple portlets with multiple XForms on a single page.

    Schema URI

    Specifies a list of external schema documents that are needed to describe the structure of the instance data and allow it to be validated.

    To add schema documents:

    1. Click Edit schema list. (The Edit Schema File List dialog displays).

    2. Click Add.

      1. In the Select Schema File dialog, specify the name and location of the schema file.

      2. Click OK.

    3. Click OK.

For more information    For information about adding events, see Customizing event handlers.

NOTE:   Some element types only allow you to add elements to the root (like Instance). Others allow you to nest elements within other elements (like bind). You can determine which elements can be nested by selecting an element (not the root) and right-clicking to see if Add item is offered on the menu.

 
Top of section

Specifying instance elements

Procedure To set instance data properties:

  1. Select an instance element (not the root).

    The instance element's properties are displayed in the Property Inspector. They include:

    Property

    Description

    ID

    A unique identifier for the instance data. This is necessary only when there are multiple instance data nodes in a single document.

    It is good practice to always allow the Form Designer to add _wsrp_rewrite_ because at runtime there might be multiple portlets with multiple XForms on a single page.

    Use pageflow data at runtime?

    Specifies how instance data should be handled at runtime (once the form is incorporated within a pageflow).

    Options are:

    • always (the default)—Always replace the data at runtime. If no replacement data is available, a runtime error is generated.

    • if-available—Replace only if new data is available at runtime; otherwise use the design-time data.

    • delete-if-not-available—Use new data if it is available at runtime. Don't ever use the design-time data—delete it.

    • never—Use the design-time data alone.

    IMPORTANT:   When you incorporate a form into a pageflow (as an XForms activity), you'll be able to specify a set of scoped paths (using the Property Inspector for the activity), indicating the replacement data for each of the replaceable <xforms:instance> nodes. (These are the instance nodes whose Use pageflow data at runtime is set to always, if-available, or delete-if-not-available. )

    Is primary instance data?

    Specifies whether data for an <xforms:instance> node is treated as the primary instance data.

    The primary instance data is the input data to the page rendering's XSLT transformation; it is the default context for use in XSLT expressions in the page. All other input data is secondary input data and can be accessed only via variable references in XSLT expressions.

    For more information    For more information, see About runtime replacement of instance data.

    Is inline?

    Check this box when data is contained within the model element of the form.

    When this is checked, you can use the instance data generated by the wizard or you can import the instance data from a file located within the project's resource set.

    See Import instance data from file (below).

    Uncheck this box when you want the data to be referenced from an external file. See Source (URI) (below).

    Import instance data from file

    To import instance data:

    1. Click the ellipsis button.

    2. In the Import File into Instance Node dialog,

      1. Type the name of the file to import.

      or

    3. Click Import, navigate to the file to import, and click Open.

    4. Click OK.

    Source (URI)

    When the data is not inline, you can specify the location of the data using a URI.

    NOTE:   The URI must reference a location within the current project's resource set.

    To add a link to the instance data:

    1. Click the ellipsis next to the Source URI text box.

    2. In the Select File dialog, choose the file and click OK.

About runtime replacement of instance data

At runtime, the form's data is replaced as specified by the Use pageflow data at runtime? property. The data is replaced for each form (which runs as a portlet) separately, and it happens before aggregation into the portal page. Additionally, the data corresponding to one or more input documents may be made available, according to the following rules:

Rule

Description

No replaceable <xforms:instance> element is specified as the primary instance data.

  • If there is only one instance element, that one instance element is treated as the primary instance data. The primary input document is mapped to the primary instance data.

  • If there is more than one default <xforms:instance> element in the page, one instance element must be defined as the primary instance data—and:

    • All other replaceable <xforms:instance> elements use secondary input data.

    • All secondary input data is made available to XSLT expressions in the page via XSLT variables. XSLT allows only a single input document, so other documents must be made accessible via the XSLT variable mechanism.

    • The variable identifiers are equal to the ID of the corresponding <xforms:instance> elements. (You use a dollar sign in XSLT to access a variable in an XPath expression; thus if you had <xforms:instance id="foo"> you'd access its runtime data via something like <xsl:value-of select="$foo/a/b/c"/>.)

For more information    For more information on adding events to the instance element, see Working with events and actions.

 
Top of section

Specifying actions

The Form Designer provides multiple ways for defining actions within your form:

Method

Description

The action node of the Model tab

Use the action node of the Model tab as a place to create one or more actions (with unique IDs) and then reference them elsewhere in your form.

The Event Editor in the Form tab

Use the Event Editor launched from the Form tab to create actions for your form controls

For more information    For more information, see Working with events and actions.

The remainder of this section describes how to specify actions in the Model tab.

Procedure To create an action/event handler:

  1. From the Model tab, select the top-level action node from the model tree.

  2. Right-click and choose Add item.

  3. Navigate to the Property Inspector and supply the following properties:

    Property

    What to specify

    ID

    Provide a unique name for the action/event handler.

    Event name

    Choose the event from the dropdown list.

    Observer

    (Optional) Choose an element as the observer.

    Target

    (Optional) Choose an element as the target of the action.

  4. Right-click and choose the action you want performed for the event.

  5. Navigate to the Property Inspector to define the specification for the selected action.

 
Top of section

Specifying submission elements

The submission element defines:

Procedure To create a submission element:

  1. From the Model tab, select the top-level submission node