Section | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
You can use the database connector to generate the schemas you will need to use in the frevvo Live Forms form.
To fetch the schema, type a URI in the browser that looks like the example below. This is almost identical to the query we used to test the connector, but it tells the connector to GET the schema instead.
...
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns="http://www.frevvo.com/database/customers" xmlns:xsd=http://www.w3.org/2001/XMLSchema targetNamespace="http://www.frevvo.com/database/customers"> <xsd:element name="customers"> <xsd:complexType> <xsd:sequence> <xsd:element maxOccurs="unbounded" name="row"> <xsd:complexType> <xsd:sequence> <xsd:element name="customerId"> <xsd:simpleType> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="11"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element minOccurs="0" name="firstname"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="50"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element minOccurs="0" name="lastname"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="50"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element minOccurs="0" name="firstname"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="50"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element minOccurs="0" name="lastname"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="50"/> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
...
</xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> |
Save the schema as an .xsd file in your file system. You can then [[V4_Data_Sources_and_Schemas#Uploading_a_Schema | upload the schema]] to frevvo Live Forms and generate controls from the schema elements that map to your database tables. If you have multiple queries in your configuration file, you’ll need to generate a schema for each query.
...
- Click the Next button to advance from the default document to the next schema document
- You should see the Document name change your schema's document name
- Enter the database connector Url to your query in the wizard's URL input. If the database connector is running in the same host and port as the frevvo Live Forms form server, then you can omit http://<host>:<port>/ from the URL. See this example below.
...
If you have already uploaded the schema to frevvoLive Forms, you can still make the changes and update the schema. The process of updating the schema is described [[V4_Data_Sources_and_Schemas#Updating_a_Schema | here]];
...
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.
...
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 Repeat Row heading in the Forms Designer and if you don’t make any changes, users will see the + sign that comes with repeat controls.
...
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> 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.
...
Code Block |
---|
<xsd:element minOccurs="0" name="Home Phone" type="phoneType"/> |
Now the frevvo Live Forms form will only accept valid phone numbers. If you enter an invalid phone the form will flag the field as invalid.
...