Creator Help

Configuring a URL Field

Overview

A Zoho Creator URL field allows you to specify a URL (Web address) with link name, title and target. The URL submitted through a form is displayed as a link in the View. Selecting the link will display the website to the viewer.

Screen-shot of a Form with URL Field type and its view that displays the URL as a link

Adding a URL field

  1. Drag and drop the URL field type to your form.

  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. This name is used to refer to the field in script mode. 
  3. Click on the checkbox options that appear under the head Appearance, as shown below.
    • Link Name Required: The Link Name is meant to display a text in place of the URL.
    • Title Required: The Title is meant to display a popup text that will be displayed, when you run your mouse over the url.
    • Target Required: The Target is meant to provide option to specify if the image must be displayed in the same window or a new window.

    Refer the topic Field Configurations to learn more about the other field configuration.

  4. The screen-shot given below, shows the url field named Site URL, added to the form, in Edit mode.
  5. When you Access this application the URL field will be displayed to enable users to specify the URL with link name, title and target. Refer screen-shot in the overview section.

Data type in scripting

The String datatype is used in scripting for URL 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.url == "") )

alert "Please enter the value for the url field";
cancel submit ;
};

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

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 syntax.

if ( zoho.adminuser != zoho.loginuserid )
{
    hide Url ;  
}

Examples

1) You can set a URL field type with the required URL, Link Name and Target using Set Variable Deluge task. In the following sample code, input.Url_Field is the name of the url field in the form, https://www.zoho.com is the URL to be set, ZOHO site is the title that will be displayed and target=’_blank’ opens the url in a new window. The script must be added to the Form Actions ->on add ->on success block of the form.

input.Url_Field= "<a href='https://www.zoho.com' target='_blank' title='ZOHO'>Visit Zoho Website here</a>";

2) The following Deluge script returns the URL without any html tags from a URL field. Add the following code to the required Form Actions block.

record = Test_Form [<criteria>]                // criteria for example [Url_Field.contains("www.zoho.com")]; 
value = record.Url_Field;
value = value.getSuffix("href= ");
value = value.getPrefix((" target"));           // value will hold the URL without any HTML tags.

Test_Form is the deluge name of the form.
Url_Field is the deluge name of the URL field in the form.
value holds the URL name without any HTML tags.

Top