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.When the form is loaded, the on add ->on load script hides the note_buffer field, using the hide syntax.
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 Fruit selected. This is then displayed in the the_note field.
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.
Adding Deluge Script
on add
{
on load
{
hide note_buffer;
}
}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;
}
)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,
- Download the script file (.ds file)
- Install the application to your account.Click here to learn how to install using the script file (.ds file)