How do I dynamically populate the label of an element?

Follow

Comments

5 comments

  • Avatar
    Will Anderson

    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!

    0
    Comment actions Permalink
  • Avatar
    Darius Grimes

    On Dynamic Label, if the value is null the Dynamic Label does not work, is there a way to use an if statement here?

    0
    Comment actions Permalink
  • Avatar
    Darius Grimes

    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?"}

     

    0
    Comment actions Permalink
  • Avatar
    Darius Grimes

    Also, can I pass data from a parent form to a child for use in a dynamic value statement? This might be an issue?

    0
    Comment actions Permalink
  • Avatar
    Tony Ruth

    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.

    function dynamicLabel(input) {
      ret="";
     if (input=="7") {
      ret =  "We have a winner";
     } else {
      ret =  "No Dice";
     } 
      return ret;
    }
    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk