Creator Help

Configuring a Numeric Field

Overview

Often it is useful to define numeric fields in the database for information such as pricing or measurement. A numeric field holds only numbers. Zoho Creator does not allow any other characters to be input in a numeric field. The message Enter a valid number for <field name> will be displayed if a user submits the form with a non-numeric value in a Numeric field type. The max number of digits that can be entered into a numeric field is 10.

To enter values like telephone numbers, ID, zip code etc., it is always better to use a text field instead of a numeric field, as these may sometimes start with a zero. In case of numeric fields, Zoho Creator automatically removes the preceding zero.

A Form that displays the Numeric Field Types supported in Zoho Creator

Types of Numeric Fields

Number:The Number field type holds plain numbers without any decimals, percentage or currency signs.

Decimal: The Decimal field type holds numbers with or without decimal places.

Percent: The percent field type holds numbers as a percentage, with or without decimal places.

Currency: The currency field type holds numbers in the specified currency format, with or without decimal places. The default currency symbol is the dollar sign ($).

Configuring Numeric Fields

  1. Drag-n-drop a numeric field type, for example, Currency to the editor area as shown below.

  1. 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. This name is used to refer to the field in script mode. 
  2. In the Currency Type list box, select the required currency.
  3. You can specify the field configurations for the currency field type, if required. Refer the topic Field Configurations to learn more about each configuration.
  4. You can edit the field configurations or to delete the field or to add field action scripts in the "Field Properties"
  5. When you Access the application, the currency field named "Rate" will be displayed as shown in the form below. The currency type will also be displayed near the field.

Data type in Scripting

The Number datatype is used in scripting for Numeric 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.Age == null) )
{
alert "Please enter the value for the field";
cancel submit ;
};

In the above code, input.Age 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,as shown in the below example.

hide <field name>;

Related Links

Phone Number Validation Example

Top