Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Modifying Controls Generated from Schema Elements

The schema you retrieve from your database will be relatively generic. As a result the controls you generate from this database schema might need some tweaking to suit the specific needs of your form. You can modify a control’s behavior by making changes to the schema after you have retrieved it. There are two ways to modify controls that you generated from schema elements. You can:  

...

You also cannot change the number of repeat items on the form. This is because the number is dictated by the minOccur in the schema. If minOccur=2 then there will by default be two repeat items displayed in the form designer, for example. Thus if you click the  displayed in the form designer on a repeat from schema, it will display a message indicating that this operation is not permitted. To change the number of items on the form, edit the schema and change minOccurs.  

Display As

...

Adding Dropdown/Radio Options

Suppose you want users to select a specific manager’s name from a dropdown list.  Your database has a 50-character limit but naturally does not include specific manager name restrictions, so the schema you retrieve initially might look something like this:

Code Block
<xsd:element minOccurs="0" name="Manager">
      <xsd:simpleType>
          <xsd:restriction base="xsd:string">
               <xsd:maxLength value="50"/>
          </xsd:restriction>
      </xsd:simpleType>
</xsd:element>

The control you generate from the initial schema will be formatted as a text control.  You can make the control a dropdown by changing the control’s Display As property but you must add the actual restrictions to the schema itself, as shown below. 

Code Block
<xsd:element minOccurs="0" name="Manager" type="ManagerType"/>
<xsd:simpleType name="ManagerType">
      <xsd:restriction base="xsd:string">
         <xsd:enumeration value="John Doe"/>
       <xsd:enumeration value="Pat Johnson"/>
       <xsd:enumeration value="Mary Smith"/>
      </xsd:restriction>
 </xsd:simpleType>

You also can populate dropdown boxes dynamically from your database by writing a rule.

Adding Checkbox Options

You may also need a control to allow multi-select options. Like dropdowns and radios controls described above, the control you generate from the initial schema will be formatted as a text control.  You can make the control a checkbox by changing the control’s Display As property to Checkbox and changing the actual schema type to xsd:list as shown below:
Image Added

Code Block
<xsd:element minOccurs="0" name="colorChoice">
      <xsd:simpleType>
           <xsd:list itemType="xsd:string"/>
      </xsd:simpleType>
</xsd:element>

Once the Color Choice control is formatted as a checkbox, a labels property will display in the properties settings tab for this control. Enter your checkbox options here.
Image Added

Limitations

Tip

Currently it is not possible to list the options directly in the schema or to have a checkbox option containing a space. So a label of "dark blue" will appear in the database as "dark_blue".

Dynamic Dropdown Options

Individual controls also may trigger SQL statements, if you’ve customized your form with rules. See Dynamic Options Rule Examples for examples of using the ResultSet returned from the Database Connector to dynamically populate the options in a dropdown control.

Adding ComboBox or Message Controls from Schema

In order to add a Message or ComboBox control, you will need to edit your schema and add the appinfo attribute. Define the attribute by adding xmlns:frevvo="http://www.frevvo.com/appinfo" at the end of Line 2 in your schema. Here is an example.

Code Block
firstline2
titleOriginal Line 2
linenumberstrue
<xsd:schema xmlns="http://www.frevvo.com/database/interns_forschema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.frevvo.com/database/interns_forschema">
Code Block
firstline2
titleLine 2 with appinfo added
linenumberstrue
<xsd:schema xmlns="http://www.frevvo.com/database/interns_forschema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.frevvo.com/database/interns_forschema"> xmlns:frevvo="http://www.frevvo.com/appinfo"

Then edit the element for the control you want to convert to a ComboBox as follows. The first line will already exist in your schema. You need to add the lines represented by lines #2-7 below.

Combobox

Code Block
linenumberstrue
<xsd:element default="ComboBox" minOccurs="0" name="Department" type="xsd:string">
				         <xsd:annotation>
					         <xsd:appinfo>
						        <frevvo:displaytype>ComboBox</frevvo:displaytype>
						        <frevvo:label>Department</frevvo:label>
					        </xsd:appinfo>
				        </xsd:annotation>
			        </xsd:element>

Here is a screenshot of a schema before and after adding the annotation.

Image Added

Message Control

Follow the same instructions as above but use this annotation:

Code Block
linenumberstrue
<xsd:element default="Message" minOccurs="0" name="MessageControl" type="xsd:string">
                <xsd:annotation>
                 <xsd:appinfo>
                    <frevvo:displaytype>Message</frevvo:displaytype>
                       <frevvo:label>Message Control</frevvo:label>
                  </xsd:appinfo>
              </xsd:annotation>
              </xsd:element>

Limiting potentially repeating Data

Often the schema from your database will allow any number of elements even though you know your form will never use more than one at a time. Every schema includes the “rows” element as shown in the partial schema below—note that based on the maxOccurs value of “unbounded” in the schema, there can be an unlimited number of customer elements. 

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns=http://www.frevvo.com/database/Customer 
targetNamespace="http://www.frevvo.com/database/Customer"> 
   <xsd:element name="Customers"> 
      <xsd:complexType> 
         <xsd:sequence> 
            <xsd:element maxOccurs="unbounded" name="row"> 
               <xsd:complexType> 
                  <xsd:sequence

Since the schema says the element is unbounded, the control you generate initially will be a repeat control.  You’ll see the the Image Addedrepeat icon in the Forms Designer and if you don’t make any changes, users will see the + sign that comes with repeat controls.

Image Added

In this case, change the schema to indicate you only want to work with one customer at a time, as shown below.     

Code Block
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns=http://www.frevvo.com/database/Customer 
targetNamespace="http://www.frevvo.com/database/Customer"> 
   <xsd:element name="Customer"> 
      <xsd:complexType> 
         <xsd:sequence> 
            <xsd:element maxOccurs="1" name="row"> 
               <xsd:complexType> 
                  <xsd:sequence>

Note that now maxOccurs="1" and that will force the + sign to disappear.

Type Restrictions

Sometimes the database field will let you enter any string such as a VarChar field. However if you field is a phone number you may which to have the form restrict the input to only valid phone numbers. See the section on patterns for more common type restrictions. In this example you still want the form input to be a text box. So we do not change the Format As.

Edit your xsd:

Code Block
<xsd:element minOccurs="0" name="Home Phone">
      <xsd:simpleType>
          <xsd:restriction base="xsd:string">
               <xsd:maxLength value="12"/>
          </xsd:restriction>
      </xsd:simpleType>
</xsd:element>

Add the following simpleType restriction to your xsd.

Code Block
<xsd:simpleType name="phoneType">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="\d{2}-\d{4}-\d{4}"/>
        <xsd:pattern value="\d{4}-\d{3}-\d{3}"/>
    </xsd:restriction>
</xsd:simpleType>

Finally change the existing type for the Home Phone element to:

Code Block
<xsd:element minOccurs="0" name="Home Phone" type="phoneType"/>

Now the  form will only accept valid phone numbers. If you enter an invalid phone the form will flag the field as invalid.

Display As

This property applies only to controls generated from XSD schema elements. If the control was dragged in from the palette, it has a Control Type property. Use the Display As property to change the way your control looks on your form when the control is imported from schema. For example, a text control can be changed to a dropdown or vice versa. Repeat and Table controls only have two options, Table and Repeat,  in the Display As dropdown. A Repeat control can be changed to a table control and vice versa by selecting the appropriate option. Refer to the Control Type property for the details.

...

The Display As property is not available for the following schema controls: Message, Date, Time, Date/Time, T/F, ComboBox. 

Required Schema Controls

The required property is disabled for controls from XSD. This is because validation is based on the XSD. Values in the xsd for the required property can be overidden with a business rule. 

Whether the control is required The required property is disabled for controls from XSD because validation is based on the XSD minOccurs value. If  If minOccurs="0" then the control is not required. If minOccurs="1" then the control is required. If minOccurs is greater than 1 then it will be rendered in the form as a repeat control with the minimum number of items set to the minOccurs value. A business rule can override the values in the XSD for the required property. 

If you want to change whether or not the control is requiredyour database column allows NULL then the XSD schema generated by the  database connector will set minOccurs='0' for this control. When this control is used in your form the field will not be required. To make this field required you have to edit the XSD to set minOccurs='1' which makes the XSD schema more restrictive then your database schema.

To change the control's required status:

  1. Write a business rule to make the field required.

    Let's say a designer created a form from a schema that contained a non-required Text field - minOccurs = 0.  The designer adds a Trigger control named tr1 and this simple rule to make the field required when the trigger control is clicked.

    Here is the relevant section of the xsd:

    Section
    Column
    width33%
    Code Block
    </xsd:element>
             <xsd:element minOccurs="0" name="NonRequiredControl" type="xsd:string">
                <xsd:annotation>
                   <xsd:appinfo>
                      <frevvo:displaytype>Text</frevvo:displaytype>
                      <frevvo:label>Non Required Control</frevvo:label>
                   </xsd:appinfo>
                </xsd:annotation>
             </xsd:element>
    Column
    width33%
    Code Block
    if(tr1.clicked){
    NonRequiredControl.required = true;
    }

    Same Rule as above built with the Visual Rule Builder

    Column
    width34%

     

  2. Edit the XSD and update it in the schema's tab for that project.

...