Working with Smart Forms

Prerequisite: Smart Forms can be created only by members of the Administrators group or those defined in Manage Members for Role: Smart Forms Admin screen

Use Smart Forms to display, save, and validate the content properly. Smart Forms use XML tags (that are hidden from users) and serve content to various presentation devices (PDAs, mobile phones, and so on), which saves users from creating duplicate content. An XML schema validation ensures the accuracy and format of your Web content, which reduces review and revision time.

Smart Form benefits

Using Smart Forms with Ektron provides the following benefits:

  • Strictly enforce content and page layout with Ektron's editor, XSLT, and WYSIWYG templates for content contributors
  • Deliver content to multiple devices (for example, PDAs, mobile phones, and so on)
  • Easily share content across B2B transactions
  • Advanced XML authoring: Ektron's highly-acclaimed XML editor lets developers hide XML tags from content contributors and provides an easy-to-use WYSIWYG editing interface

The following are examples of industries that can benefit from XML Indexing.

  • Health Care—A cardiologist whose practice is located in your city
  • Human Resources—Sick time policy
  • Real Estate—A house with a zip code of 03031 priced under $200,000
  • Hospitality—A hotel in the city
  • Online Retail—Fleece gloves for men
  • Educational—A course in .NET programming
Using XML instead of HTML

You should use XML content whenever possible because of the following advantages.

  • Standardized format for capturing content
    • You can create an XML Smart Form then require anyone creating content in a folder to use the form. The result is more uniform and consistent information.
    • Within an XML Smart Form, you can require authors to complete fields in a specified format. So, for example, if you want the author to enter a date, XML can ensure that it’s captured in a standard format. Several standard formats are provided (email address, zip code), and you can create your own.
  • Superior control over content display
    • Authors contribute XML content but have virtually no control over its format. The Web administrator determines the format through an XSLT file. By customizing the XSLT, you can exert maximum control over your Web site’s appearance.
    • Because one file controls several (even hundreds of) pages, you can update just that file to efficiently change the look of all pages whose content is based on the Smart Form.
  • Improved search capabilities
    • Because XML data is captured in individual fields, you can focus a search on relevant fields. For example, if your XML content captures data about books, you can place an author search on your Web site. Because that search only looks through content in the Author field, it is much faster and returns more reliable results than a search of HTML content.

To access the Smart Form section of the Workarea, go to Settings > Configuration > Smart Form Configuration. The View Smart Forms screen appears.

—Image—

When you click a Smart Form to view its information, you can do the following:

  • Edit—Edit a Smart Form.
  • Data Design—Open Data Designer.
  • Add Smart Form—Create a new Smart Form from scratch or based on an existing one.
  • View XSLT—Display a Smart Form’s XSLT.
  • Delete—Delete a Smart Form.
  • Back—Return to previous screen.
—Image: Properties tab—

  • Title—Name given to Smart Form.
  • ID—ID number assigned by Ektron upon creation of the configuration.
  • Description—Detailed description of configuration given by creator or last editor.

If the Smart Form was created using external XML files (instead of the Data Designer), the following information also appears:

  • Edit XSLT—XSLT applied to the content when being edited.

    NOTE: If no edit XSLT is specified, the Edit Data Design option is enabled in the toolbar.

  • Save XSLT—XSLT used to transform the XML created in the editor when the Smart Form is saved to the database.
  • Advanced Configuration—XML file that contains display information, schema validation, and other advanced XML data.
  • XML Schema—Specify the .xsd file used to validate the XML content that the Smart Form will be assigned to.
  • Target Namespace—Specify the default namespace used for outgoing XML.
—Image: Display Information tab—

The display information tab lists the XSLTs that are used when displaying XML in the respective environment.

  • XSLT1—Display XSLT 1
  • XSLT2—Display XSLT 2
  • XSLT3—Display XSLT 3
  • XSLT (Packaged)—Display XSLT Package (created using the Data Designer)
  • XPaths—Location of the XSLT.

NOTE: When a Smart Form is created using the Data Designer, a default display XSLT is also created which looks similar to the edit XSLT created in the editor. This default XSLT can be applied to the XML content.

The asterisk (*) denotes the default XSLT for the Smart Form.

Preview tab

The Preview tab displays the XSLT applied to the editor when XML content is created. This is the XSLT that was created for the Smart Form.

Adding a Smart Form

Adding a Smart Form

If you need to make major changes to a Smart Form, copy it and modify the copy so that you do not affect the content controlled by the original configuration. To copy a Smart Form:

  1. Choose Workarea > Settings > Configuration > Smart Form Configurations.
  2. Click on an existing Smart Form.
  3. Click Add Smart Form. The Add Smart Form Configuration screen appears.
  4. Specify a Title for the copy of the Smart form and click Add Smart Form. The new title appears in the Smart Forms list and its description shows that it was derived from an existing Smart form.

A verification button () appears to the right of some fields on the Add Smart Form screen. After you identify an XSLT or schema, you can click this button to verify that the file exists in the location specified and contains well-formed XML.

NOTE: The XML Verification feature does not validate the contents of the XML file.

Possible results when clicking the verification button:

  • Verified—File passes all verification parameters.
  • Not Verified—The file either does not exist in the specified location, or does not contain well-formed XML. Review current settings. Ensure the file is in the proper location, and that it contains well-formed XML
Adding a Smart Form using the Data Designer

Adding a Smart Form Using the Data Designer

  1. Choose Workarea > Settings > Configuration > Smart Form Configurations.
  2. Click Add Smart Form. The Add Smart Form screen appears.
  3. Enter a Title for the Smart Form configuration and click Save. The Smart Form Data Designer screen appears.
    —Image—

  4. Design your Smart Form configuration in the Data Designer. See Creating a Smart Form for information about creating XSLTs using the Data Designer.
  5. Click Update.

You are ready to assign the Smart Form configuration to a folder or content item. See Assigning a Smart Form to a Folder for more information.

Adding a Smart Form using external XML files

Adding a Smart Form Using External XML Files

WARNING! If you want users to insert Smart Form information using eWebEdit400, you cannot create or edit Smart Forms using external files. However, you can access eWebEdit400's source view, paste the external file's XML, then return to design view.

To add a Smart Form using external XML files:

  1. Choose Workarea > Settings > Configuration > Smart Form Configurations.
  2. Click Add Smart Form. The Add Smart Form screen appears.
  3. Enter a Title for the Smart Form configuration.
  4. Click Save. The Smart Form Data Designer screen appears.
  5. Click Backarrow () to exit. The View Smart Form screen for the new Smart Form configuration appears.
     

  6. Click Edit (). The Edit Smart Form screen appears.
  7. Enter the following information.

    General Information

    • Title—Name given to Smart Form configuration.
    • ID— (display only)ID number assigned when configuration is created.
    • Description—Detailed description given to configuration by its creator or last editor.

    Editor Information

    • Edit XSLT—XSLT applied to content while being edited.
    • Save XSLT—XSLT used to transform the XML when saved to the database.
    • Advanced Configuration—XML file that contains display information, schema validation, and other advanced XML data.

    Validation Information

    • XML Schema—The .xsd file used to validate the XML content.
    • Target Namespace—The default namespace used for outgoing XML.

    Display Information

    • XSLT1—XSLT 1 applied to XML data when viewed on a device.
    • XSLT2—XSLT 2 applied to XML data when viewed on a device.
    • XSLT3—XSLT 3 applied to XML data when viewed on a device.
    • XSLT (Packaged)—XSLT package applied to XML data when viewed on a device.

    NOTE: When a Smart Form configuration is created using the Data Designer, a default XSLT is created based on the configuration. To learn about modifying the packaged XSLT, see Editing a SmartForm’s XSLT.

  8. Specify the default display XSLT for the configuration by clicking the corresponding radio button.
  9. Click Update.
Creating a Smart Form

Creating a Smart Form

For each field on the screen:

  1. Insert a field label.
  2. Place the cursor at the desired location.
  3. Click the button corresponding to the desired field type.

Ektron provides several options that let you insert or edit fields in the editor. Each field type is described below.

—Data Field Types—
  • Data Field Types ()

    NOTE: For information about these data field types, see Using Data Field Types.

    • Calculated—Performs calculations using other fields on the screen. See Calculated.
    • Calendar—Lets user insert a date by clicking a calendar. See Calendar.
    • Checkbox—User’s response is either checked or unchecked. See Checkbox.
    • Choices—Several choices appear on screen. User checks appropriate boxes. All user choices are inserted as values within single XML tag. See Choices .
    • Group Box—Groups related fields, which can be surrounded by a box and have a caption. See Group Box.
    • Image Only—Lets user insert an image. See Image Only .
    • Link Field—Lets user insert a link to a file, such as a PDF document. See Link.
    • Resource Selector—Lets user place content or folders on a Smart Form. See Resource Selector.
    • Tabular—Same as group box, but fields can be presented in a table format. See Tabular Data.
    • Text—Lets user insert and format free text using editor See Text.
  • Check Compatibility—Checks the design against existing data.
  • Field Properties—Lets you change a field's properties. Select field then click this button. This option is also available on the right click menu.
  • View Data as...
    • The XML data document
      - <root>
      - <Information>
      <LastName />
      <FirstName />
      <MiddleName />
      <Gender>male</Gender>
      <Address />
      <city />
      <state>MA</state>
      <Zip />
      <SSN />
      <BDate />
      <HomeTel />
      <WorkTel />
      <x-ray />
      - <Dental_Insurance>
      <Field1 />
      <OtherInsurance>N/A</OtherInsurance>
      <Account_Number>N/A</Account_Number>
      </Dental_Insurance>
      <medication />
      <lastAppointment />
      <clincal />
      </Information>
      </root>
    • The structure, content, and semantics of an XML document
      - <xs:schema elementFormDefault="qualified" 
           attributeFormDefault="unqualified" 
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
      - <xs:element name="root">
      - <xs:complexType>
      - <xs:sequence>
      - <xs:element name="Information">
      - <xs:complexType>
      - <xs:sequence>
      - <xs:element name="LastName">
      - <xs:simpleType>
      - <xs:restriction base="xs:string">
        <xs:minLength xmlns:xs="http://www.w3.org/2001/XMLSchema" value="1" />
        </xs:restriction>
        </xs:simpleType>
        </xs:element>
      - <xs:element name="FirstName">
      - <xs:simpleType>
      - <xs:restriction base="xs:string">. .. ..
      
    • A list of all fields and information about them (as XML)
      <fieldlist>
      <field name="LastName"
        datatype="string" 
        basetype="text" 
        xpath="/root/Information/LastName" 
        title="Last Name">Last Name</field>
      <field name="FirstName" 
        datatype="string" 
        basetype="text" 
        xpath="/root/Information/FirstName" 
        title="First Name">First Name</field>
      <field name="MiddleName" 
        datatype="string" 
        basetype="text" 
        xpath="/root/Information/MiddleName" 
        title="Middle Name">Middle Name</field>
      <field name="Gender" 
        datatype="choice" 
        basetype="text" 
        xpath="/root/Information/Gender" 
        datalist="IDAPK3KC">Gender</field> . .. .. ..
    • xpath information for any indexed field on the screen
      <indexable>
        <xpath type="string">/root/Information/SSN</xpath>
        <xpath type="string">/root/Information/HomeTel</xpath>
        <xpath>/root/Information/WorkTel</xpath>
      </indexable>
    • The Data Design document’s presentation XSLT
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" version="1.0" omit-xml-declaration="yes" indent="yes" encoding="utf-8" />
        <xsl:strip-space elements="*" />
        <xsl:variable name="ektdesignns_fieldlist" select="/*/ektdesignpackage_list/fieldlist" />
      - <xsl:template match="/" xml:space="preserve">
          <p> </p>
      - <fieldset id="Information" title="Demographic Information">
        <legend>Patient Information</legend>
      - <div>
      - <p>
        <strong>Last Name</strong>
        <xsl:text> </xsl:text>
      <xsl:value-of select="/root/Information/LastName" />
        <strong>First Name</strong>
        <xsl:text> </xsl:text>
        <xsl:value-of select="/root/Information/FirstName" /> .. .. ... ..
  • Validate—Validates data when previewing data entry. This button is available in data entry and data design modes.

Buttons at the bottom of the Data Designer screen in eWebEdit400 let you edit the content several ways.

  • Data Design mode —lets you insert and remove fields from the screen.
  • XML mode—lets you edit the XML source code. If the edited source XML is not well-formed, you are notified and must remain in source view until you fix it.
  • Data Entry mode— simulates the screen’s appearance during data entry.

To edit any field's properties, select it, right click the mouse, and select Field Properties.

You also can use Ektron’s rich formatting capabilities to design the screen. For example, you can format text, and use tables, images and hyperlinks to guide the user through the data entry process.

—Image: Sample data entry screen—

Creating a simple data entry screen

Creating a Simple Data Entry Screen

The following example shows how to create a simple data entry screen that has a group box with 2 text fields and a choices field.

  1. Sign on to the Ektron Workarea as an administrator or a Smart Form administrator. See Also: Defining Roles
  2. Go to Settings > Configuration > Smart Form Configurations.
  3. Click Add Smart Form.
  4. Assign the form a title and click Save. For example, Sample Smart Form. The screen refreshes and the editor appears.
  5. Click Group Box ().
  6. Type Address in the Descriptive Name, Field Name, and Caption fields and click OK. The Address group box appears on the form.
  7. Click in the Address box and type the label "Street: " then click Text Field ().
  8. Type Street in the Descriptive Name, Field Name, and Tool Tip fields and click OK. The text field box appears on the form inside the Address group box.
  9. Under the Street label, type the label "City: " then click Text Field ().
  10. Type City in the Descriptive Name, Field Name, and Tool Tip fields and click OK. The text field box appears on the form inside the Address group box.
  11. Under the City label, type the label "State" then click Choices Field ().
  12. Type State in the Descriptive Name, Field Name, and Tool Tip fields
  13. Choose U.S. States & Territories from the List menu.
  14. Click OK. The field box appears on the form inside the Address group box.
Inserting a conditional section

Inserting a Conditional Section

You can specify a field or group of fields to appear on a Smart Form configuration only under certain conditions. For example, a Winter outdoor image does not appear until November, and drops off on April 1. As another example, one group of fields appears if the user is using a mobile device (such as a smart phone), and a different set of fields appears if the user is not on a mobile device.

  1. After you insert the fields on a Smart Form configuration, click the Conditional Section toolbar button (). The Conditional Section dialog box appears.
  2. Specify the condition. The Examples pulldown has sample conditions that you can insert then modify. The following examples show conditions that display only if...
    • The user is viewing the Web page on a Smart Phone

      $deviceConfiguration = 'Smart Phones'

    • The user is viewing the Web page on a device that is not a smart phone

      not($deviceConfiguration = 'Smart Phones')

    • The user is viewing the Web page on January 1, 2011 or later

      $currentDate >= '2011-01-01'

    • The person viewing the Web page is a logged-in Ektron user

      $userId != '0'

    Use xpath to build the expression. For example, $deviceConfiguration = 'Smart Phones'. You can click View Data as Index () to see the configuration's xpath structure.

    NOTE: Developers can modify the examples by editing this file: workarea/ContentDesigner/ConditionalExamples.xml.

  3. Select a variable to replace. For example, select X.
     

  4. Select a field from the lower section of the dialog. For example, select Smart Phones.
  5. Click Replacefieldin Condition.
     

    replace variables

    The expression looks like this: $deviceConfiguration = 'Smart Phones'

Limitations on Conditional Sections

  • You cannot apply a conditional section to a rich area field.
  • You can only apply a conditional section to a Smart Form configuration. You cannot apply a conditional section to XML Smart Form content created from a configuration. But, authors creating or editing that content see conditions
     

Editing a Smart Form's XSLT

Editing a SmartForm’s XSLT

Every Smart Form has a packaged XSLT, which is a default XSLT created from the configuration’s display information. To modify the Smart Form’s appearance:

  1. Go to Settings > Configuration > Smart Form Configurations.
  2. Click the Smart Form configuration whose XSLT you want to customize.
  3. Click View XSLT ().
  4. Select and copy the XSLT and paste it into an XSLT editor.
  5. Customize the file.
  6. Save it with an .xslt extension to your site root/xmlfiles folder.
  7. Return to the Smart Form configuration you selected in Step 2 and click Edit.
  8. In the XSLT1 field, enter the Xslt you saved in Step 6.
  9. Click the radio button next to XSLT1.
  10. Click Update.

You can edit the custom XSLT at any time. The changes immediately affect the appearance of the Smart Form on your Web site. So, the XSLT is quite different from other aspects of the Smart Form configuration, which generally cannot be edited for existing content.

To view a Smart Form's XSLT, click (). The View XSLT screen appears. You can use this information to create your display XSLT.

 

Assigning a Smart Form to a folder

Assigning a Smart Form to a Folder

If you break inheritance on the Smart Forms tab of a folder properties screen, you can select the Smart Forms to be assigned to content in the folder.

 

  • To preview a Smart Form, click Preview ().
  • To add any Smart Form, select it from the drop-down list and click Add ().
  • To remove a Smart Form, click Remove.
  • You can require a Smart Form to be the only type of content that can be added within a folder by checking the box next to Require Smart Forms. If you do, the user can only choose enabled Smart Forms when viewing that folder’s New menu—all other content types are suppressed.

See also: