Stateless Forms

Overview

While creating a new Form, Zoho Creator displays the check-box option "Data will be stored in Zoho Creator", which is checked by default. De-selecting this option will create the Form as a Stateless Form. Unlike Regular Forms, these Forms do not have a default "Submit" and "Reset" buttons. Instead you can add custom (scriptable)buttons which when clicked, can execute automated tasks according to the written Deluge scripts. The entered data is not automatically added to the table as an inserted record. This gives you the flexibility of storing the entered data into any Field of any record of any Report in Zoho Creator. You can even use it to retrieve data from any Field in any record of any Report in Zoho Creator. Some common usage of the Stateless Forms are listed below:

  • Create Web Forms: Stateless Forms can act as web forms that are embedded in websites. This Form data can be submitted to any service or used to update a record in another Form/Application, without persisting data in Zoho Creator. The Deluge Get URL and Post URL task can be used to GET/POST data to external websites or other Zoho Creator Applications.
  • Create multiple Forms amd updating their data in a single Report: Since a Stateless Form is by definition not joined with any particular Report, you can design different Stateless Forms each with a different subset of Fields in a particular Report. For example, you can create one Stateless Form for the role "Technician" and another Stateless Form for the role "Manager" and share it with the respective roles but persist the data submitted from all the Stateless Forms in the same main Report. This enables different users within the same organization use the different Stateless Forms to perform their assigned tasks without having access to the other fields in the Report.
  • Create user settings dialog for the real time apps: Create a Stateless Form to enable users to customize all the properties of an Application in one single Form. For example, add a "Settings" link to your Application that will fetch the record for the current logged-in user and set the values in the On Load of the Stateless Form. Users can modify their settings and submit the Form. This Form will then update records in the main Form.
  • Fetch and Display information from other Forms: Create a Stateless Form to fetch and display information from other Zoho Creator Forms or from other services, based on the Form input. For instance, assume you have a Status Form in your Application to display the Status of a particular Work Order. When a user inputs their Work Order number and clicks on the Form button, the Status must be displayed. In this case, it is not necessary to store the Form data. You can create a Status Form and write On Click Form action to display the Status in a Note field.
  • Generate dynamic HTML page: Create Stateless Forms to generate a dynamic HTML Page by passing the Form data as parameters to the Page. For example, specify the search criteria to display records from a Contacts Management Application, specify the Month and Year to display records pertaining to a specific period.
  • Execute Send Mail: Create a Stateless Form to execute any Deluge task like Send Mail, on click of the Form button. In addition to On Click Form actions, you can also execute On User input Field action scripts.

 Creating a Stateless Form

To create a Stateless Form,

  1. Click on Create New -> Form from your Application home page. 
  2. In the New Form page, specify the Form name
  3. Deselect the option Data to be stored in Zoho Creator and click Create to create the Stateless Form.
  4. Drag-n-drop the required Fields on the Form.
  5. Use the (+) link, to add Custom buttons to the Form, by specifying the button name and type in Field Properties.
    • Custom button: On click of this button, invokes the "On Click" action of the button. Read point 6 for details.
    • Submit button: On click of this button or if Enter Key is pressed, invokes the "On Click" action of the button. Read point 6 for details.
    • Reset button: On mouse click of this button, Form is taken to the initial state. "On Click" action cannot be configured for Reset button.
  6. To perform any action on click of the Form button, navigate to Workflow and add the required Deluge scripts(to perform automated tasks) in the Form Actions -> Form Button Name -> On Click. For example, if you add a custom button named "Add", write the Deluge script at Workflow -> Forms -> Add -> On Click.
  7. Click Save script to update the script.
  8. Click on Access this application and enter data to the Stateless Form. On click of the Form button, the script added to the "On Click" block will be executed.

 Convert Normal to Stateless Form

An existing Form in Zoho Creator can be converted into a Stateless Form. For more details, please refer this link.

 Example

Assume there is a Contacts Form to store contact details like Name, Address, Mobile Number and Email id. And there is a Stateless Form to fetch and display data from the Contacts Form, based on the specified "email id". The fetched data can be modified and submitted, which will also be updated accordingly in Contacts Report.

  1. Create a Contacts Form with Name, Address, Mobile Number and Email id field types.
  2. Create a Stateless Form with Email Id as Lookup Field to the Contacts Form and other required fields, as shown in the screen-shot given below:
  3. To fetch the corresponding record from the Contacts Form according to the selected Email id, add the following script under Workflow -> Field Actions - > Email_id -> On User input.
    record  =  Contacts  [ID == input.Email_id];            // Contacts is the Form link name
    input.Address = record.Address;                         // Address is the field deluge name
    input.Mobile_Number = record.Mobile_Number;             // Mobile_Number is the field deluge name
    input.Name = record.Name;                              // Name is the field deluge name
  4. When an Email id is selected, the corresponding record is fetched from the Contacts Form and displayed in the Stateless Form, as shown in the screen-shot below.
  5. Update the record with required values and click on Update. The modified values will be updated in the Contacts Form. This is achieved by writing the following script under Workflow -> Form Actions -> Update -> On Click.
    record  =  Contacts  [ID == input.Email_id];            // Contacts is the Form link name
    record.Name = input.Name;                               // Name is the field deluge name
    record.Address = input.Address;                         // Address is the field deluge name
    record.Mobile_Number = input.Mobile_Number;            // Mobile_Number is the field deluge name

 Related Links