6 Replies Latest reply on Jul 24, 2013 10:32 AM by JMVan7855

    Change text field display value based on value (short sample code provided)

    JMVan7855 Level 1

      I've read around on this for a couple of days, but I still can't get it to work well.

       

      I have a text field named "W1SnC1". Actually I have several fields to run this in. That's why I tried to make the below script generic. Basically, I want to change Properties > Form Field to "Visible but doesn't print" if the text field contains "--". (As a side note "--" is the default value). I put the below script in Properties > Validate > Run custom validation script:

       

      var elemName = event.target.name;

      if(event.value == '--')

      {

      elemName.display = display.noPrint;

      } else

      {

      elemName.display = display.visible;

      }

       

      Its odd but every once in a while it works :-) I think I must be clicking something that queues the validation at those times. However, I just need some general help. Would someone mind giving advice on what to change?