Creator Help

Configuring A Text Field

Overview

A text field can be either a single line or multiple lines. Text fields are one of the most common fields you will see on the internet. They are a box on a web page that visitors are able to select and type text into it. You can enter any kind of character into a text field.

Single-line text field: Use a single line text field to hold plain text or data that doesn't fit well into any other type of field. A single-line text field can contain a maximum of 255 characters.

Multi-line text field: A multi- line text field is also similar to a single-line text field, but with more text area. It can contain any type of character and is appropriate for a comments or a notes field in a Form.Zoho Creator allows only 65,535 bytes (~64kb) of data in the multi-line text field. Refer the Known Issues and Limitation section for more information.

Configuring a text field

  1. Drag-n-drop the Single Line or Multi Line text field to the editor area.
  2. In the Field Name textbox, specify the name that will be displayed for this field in the Form. The Deluge Name of the field will be same as the field name with underscore instead of white spaces, and will be assigned automatically by Zoho Creator.
  3. Specify the other field configurations if required. Refer the topic Field Configurations to learn more about each configuration. 
  4. To edit the field configurations or to delete the field or to add field action scripts, select the field and make the necessary changes in field properties. The changes you make will be auto saved.
  5. When you Access the application, the text field will be displayed to enable users to add text into it.

Data type in scripting

The String datatype is used in scripting for both single & multiline text field type.

Validation

Make Field Mandatory

Setting a field to Mandatory, forces the user to fill a value for the particular form field. 

GUI

To make a field mandatory through GUI, please refer the following link.

Script 

To make a field mandatory through script,

  • Go to edit mode of the application.
  • Click on the Form Actions --> On validate from the workflow tab.
  • Enter the code and click on "Save script " button.
  • The mandatory option is now enabled for the particular field.

For example, the sample script shown below indicates the user that the field value is mandatory and requires data to be entered in the field.

if ( (input.Product == "") )
{
alert "Please enter the value for the field";
cancel submit ;
};

In the above code, input.Product is the field where the field value is mandatory.

Set default value 

Now you can set a default value for a field in the form. There are two possible ways to perform this action.

GUI

To set default value for a field through GUI, please refer the following link.

Script

You can use this option to set up dynamic values to fields. Setting today's date for a Date field, current time for a Date-Time field, logged in user's email for Email field are some examples.

This can also be used for the fields where you see the "Initial Value" option missing.

1. In the edit mode, click on workflow tab.

2. Go to On Add -> On Load script section of the Form.

3. Enter the code shown below and click on "Save script " button.

    input.field name = input.value

4. Now you can see the default value in the field while accessing the application.

Make a field value unique

Selecting a field value unique for a particular field will  not accept any duplicate values while submitting the form. There are two possible ways to perform this action.

GUI

To set a field value as unique for a field, please refer the following link.

Script

To make a field value unique in scripting,

  • In the edit mode, click on workflow tab.
  • Select Form actions--> On Add -> On submit .
  • Enter the code and click on "Save script " button.
  • Now access the application.

The sample script shown below is an example for making a field value unique through scripting.

if(count(Contacts[Name == input.Name &&DOB == input.DOB]) >0)
{
alert “Contact ” + input.Name + “|” + input.DOB ” already exists”;
cancel submit;
}

Permission

The permission option supports the show/hide functionality to create forms that hide the information from the user or adjust the fields while the user is entering the data . There are two possible ways to perform this action.

GUI

To enable the show/hide functionality from the GUI, please refer the following link.

Script
  • Go to  Form Actions -> on add ->on load .
  • Enter the code and click on "Save script " button.
  • Now access the application to find the changes made in the script section.

In the Form Actions -> on add ->on load script of the form, hide the required fields, for example, Field 1 and Field 2 by adding the following piece of code as shown below.

hide <field name>;

Set Maximum Limit

Maximum number of fields in a form depends on the type of fields used and the maximum length of the field. Below are the limitations related to Single Line text field type.Form can have maximum of 80 text fields with max length of 255(SingleLine). This can be increased by reducing the max length value.

Related Links:

Phone Number Validation Example

Top