iFormBuilder Smart Controls
Table of Contents
What are Dynamic Values?
Using valid JavaScript, you can dynamically populate fields on your form. These are called Dynamic Values.
Click here for information on using Dynamic Values.
What is Dynamic Label?
The Dynamic Label field is used to change the label of an element based on specific conditions; answers provided in previous fields on the form.
How do I dynamically populate a label of an element?
To implement this feature, please follow the instructions below.
PLEASE NOTE: In the following example, we will dynamically change the Label element to My name is Joe.
STEP 1. With your form loaded in the form builder, add a Pick List element to your form (attaching an Option List with a list of names). For this example, the data column name is select_your_name.
STEP 2. Add a Label element to your form. For this example, the data column name is my_name_is_ (although this doesn't matter as it will be changed dynamically).
STEP 3. In the Dynamic Label field of the Label element, put the following:
"My name is" + " " + ZCDisplayValue_select_your_name
STEP 4. On the device, select Joe from your Pick List element.
STEP 5. You will see the label of the second Label element changes to My name is Joe.
Watch the Video Below to Learn how to Implement Dynamic Label
iForm Tip: Download the Form Package at the bottom for a sample form of this functionality.
Comments
5 comments
How can option list choices from PICK LIST, SELECT, MULTI-SELECT widgets be used in a dynamic label? If so, can the option list choice's ZCDisplayValue be used (seems simplest solution but haven't been able to get it to work) or does the choice value need to be translated first (e.g. using ZCDisplayValue in a TEXT element)? Thanks!
On Dynamic Label, if the value is null the Dynamic Label does not work, is there a way to use an if statement here?
I have several elements that are read only and the data is provided by a csv import.
One is called usage_type
My Dynamic Label is "Application states the Usage Type is:" +usage_type +" , is this correct?"
If the data provided in the csv is null the Dynamic Label returns usage_type
Is there a way to say: if (usage_type =="") {"Usage Type not provided"} else {"Application states the Usage Type is:" +usage_type +" , is this correct?"}
Also, can I pass data from a parent form to a child for use in a dynamic value statement? This might be an issue?
Hi Darius, you can use if / else logic in the Dynamic value to evaluate a field or set of fields and then generate the label as you see fit. You may also use page level functions and call the function from the Dynamic Label with a given input(s).
Here is a quick sample I made from two elements and the page level function which supports it. The label changes based on the value entered in the field generate_dynamic_label_for_photo.
Please sign in to leave a comment.