2 Replies Latest reply: Oct 31, 2014 11:36 AM by kkoenen RSS

    How do I code conditional text?

    kkoenen Community Member

      I have a form that needs to display Text Block 1 only if the "Total" is up to $499.99." If $500 or greater, I need to hide Text Block 1 and show Text Block 2.

       

      Is there any way I can do this?

       

      Thanks.

        • 1. Re: How do I code conditional text?
          radzmar Community Member

          Assuming your text blocks are different text objects and total is a numerice field, you can use a script in the total field calculate event.

           

          FormCalc:

          if ($ lt 500) then
              textBlock1.presence = "visible"
              textBlock2.presence = "hidden"
          else
              textBlock1.presence = "hidden"
              textBlock2.presence = "visible"
          endif
          

           

          JavaScript:

          textBlock1.presence = this.rawValue < 500 ? "visible" : "hidden"; textBlock2.presence = this.rawValue < 500 ? "hidden" : "visible ";
          • 2. Re: How do I code conditional text?
            kkoenen Community Member

            Beautiful!  That is just what I needed.

             

            Thanks so much for taking the time to respond.

             

            Katy