Data Definition Site Form Submit
Author: Steven Pease
1. Introduction
This guide provides instructions on how to publish a page containing a form rendered from a provided data definition, where the form can submit its data to a published php script in order to make a newly created asset within Cascade Server. This guide assumes you have PHP (version 5 or greater) installed on your web server and that you are comfortable with Cascade Server. Knowledge of PHP is also useful, but not necessary to use this guide.
2. Components
There are several components to this script including the script itself, another php file containing needed PHP API calls, a configuration page, a form page, an XML block, a stylesheet, and a mimic page.
3. The Form Page
In order to make the form page, you must first create the XML block and stylesheet that the form page's DEFAULT region will use. Create a new XML block using "data-def-example.xml" and a new stylesheet using "data-def-submit.xsl". Next, create the form page and set its DEFAULT region's block and stylesheet to the XML block and stylesheet you just created.
4. The Mimic Page
Create a page called "mimic-page", give it a .php publish extension and the "data-def-example.xml" data-definition. All newly created pages using this script will look like this system-page; only the system-data-structure of the page will be changed.
5. The Configuration Page
Create a page called "data-def-submit-config.xml" in the same folder as the form page, and give it a .php publish extension and the "data-def-submit-config-data-definition.xml" data-definition. Supply a valid server URL, username, password, CMS folder path that you want newly created pages to be created in, and the CMS path to the mimic page.
6. Usage
Upload both "data-def-submit.php" and "wsdl.php" to the same directory as the form page you've created. Then publish the two php files along with the form page and configuration page. Browse to the form page from your server, fill out the form and click "Submit". If any required fields are not filled out and you have Javascript enabled, the browser will not allow you to submit the form until all those fields are provided. Once you are able to submit the form and are taken to another page, a new page will be added in the CMS in the folder you provided in the configuration file.
Files
- data-def-submit.zip
This is a zip file with all the necessary scripts and XML. - data-def-example.xml
This is an example data definition that the form on the live site is built from. - data-def-submit-php.txt
This is the main PHP script that handles the form post. - data-def-submit.xsl
This is the XSL that transforms the data definition XML into an HTML form. - data-def-submit-config-xml-php.txt
This is an example XML config file. - data-def-submit-config-data-definition.xml
This is an example data definition to visually build the XML config file. - wsdl-php.txt
This is the PHP API script for interfacing with the WSDL in Cascade Server.