How can I display custom error messages in my form?

How can I display custom error messages in my form?

About the Application

A Note field is used to display text or images that guide the user while filling the form. This field will not be displayed in the View. You can display custom error messages in the Note field based on user input, using Deluge Scripting. The sample application Update Note  demonstrates how to display customized text in a Note field, based on user input to your form.. The script modifies the content of a Note field when a client-side event happens.

The application comprises of a form named Test form with the following fields:

  1. Fruit of type picklist to display the types of fruits.
  2. Flash monkey of type decision check box.
  3. note_buffer of type multi-line text to store the html image code, based on the selected fruit.
  4. the_note of type note to display the image of the selected fruit.

Adding Deluge Script

1. When the form is loaded, the on add -> on load script hides the note_buffer field, using the hide syntax.

on  add
{
on load
{
hide note_buffer;
}
}


2. The on user input script added in the Fruit field updates the note_buffer with a blob of HTML as a multiline string, based on the Fruitselected. This is then displayed in the the_note field.

Fruit
(
type = picklist
values = {"apple", "banana", "cantelope"}
on user input
{
if (input.Fruit == "apple")
{
input.note_buffer = "<img height='250' width='250' src='http://images.jupiterimages.com/common/detail/39/61/23036139.jpg'/>";
}
else if (input.Fruit == "banana")
{
input.note_buffer = "<img height='250' width='250' src='http://www.momadvice.com/blog/uploaded_images/banana-759611.jpg'/>";
}
else if (input.Fruit == "cantelope")
{
input.note_buffer = "<img height='250' width='250' src='http://www.kids-cooking-activities.com/images/cantelope.jpg'/>";
}
input.the_note = input.note_buffer;
}
)


Code Explanation

if (input.Fruit == "apple") - If condition to check the Fruit type

input.note_buffer = "<img height='250' width='250' src='http://images.jupiterimages.com/common/detail/39/61/23036139.jpg'/>"; - Stores the html code as a multi-line string in the note_buffer field.

input.the_note = input.note_buffer; - Updates the_note field with the value stored in the above note_buffer field. This field displays the actual image.

3. If the show_monkey checkbox is selected, the on user input script added in the show_monkey field updates the note field with the fruit type and the monkey image, else only the fruit type is displayed.

show_monkey
(
displayname = "Flash monkey?"
type = checkbox
defaultvalue = false
on user input
{
if (input.show_monkey)
{
input.the_note = input.note_buffer + "<img height='250' width='250' src='http://upload.wikimedia.org/wikipedia/commons/2/27/Baby_ginger_monkey.jpg' />";
input.show_monkey = false;
}
else
{
input.the_note = input.note_buffer;
}
}
)


To install the application,

  1. Download the script file (.ds file)
  2. Install the application to your account. Click here to learn how to install using the script file (.ds file)
    • Related Articles

    • Zoho Mail Add-on - Error Messages

      The error messages you may view while configuring the Zoho Mail Add-on are: Mail Box (yourmailID) you have configured earlier is not reachable. Please select a new "Mail Box". One of the instances why this message will display is when you change ...
    • Error Messages

      Error Code Description 4000 Please use Authtoken, instead of API ticket and APIkey. 4500 Internal server error while processing this request 4501 API Key is inactive 4502 This module is not supported in your edition 4401 Mandatory field missing 4600 ...
    • Custom Functions

      Zoho Recruit Custom functions help you to update data in related Recruit modules or third-party applications by executing simple program scripts. When a record matches the workflow criteria, workflow engine automatically triggers the custom ...
    • Custom Buttons

      Zoho Recruit offers standard buttons that execute predefined actions. For example, Associate to Job Openings is a standard button used to link a Candidate to a Job Opening, Clone is another standard button that is used to clone any record within your ...
    • Custom Workflow

      Create custom workflows to suit your various business needs. Custom workflows is an important automation tool that allows you to create processes unique to your product enabling you to define the various paths your contacts can take in a workflow. ...