18 Replies Latest reply on Jul 25, 2014 3:33 PM by try67

    Change true/false value on form field to 'X' or blank

    JRiffe

      Hi,

       

      I have been trying to change the values in a text field that come in on a form as true/false values when the document loads.  I have tried field calculation and format where I change the value, however, those values will not change unless a value on the form is modified first, which did work, however that behavior is not desired.  I have then tried document level javascript, however, I can't even get the app.alert to fire when the document loads.  I have tried the javascript in several ways. 

       

      This is what I currently have in the doc level javascripts:

      function CourseSelections()

      {

         app.alert("Hooray!");

        if(this.getField("Course_Selection_MS_Career_Exploration").value == true){

          app.alert(this.getField("Course_Selection_MS_Career_Exploration").value)

          this.getField("Course_Selection_MS_Career_Exploration").value = 'X';}

        else{

          app.alert(this.getField("Course_Selection_MS_Career_Exploration").value) 

          this.getField("Course_Selection_MS_Career_Exploration").value = '';

        }

      }

       

      I have also tried (although I think event can only be set from a field level script and not in the doc level scripts):

      var x = this.getField("Course_Selection_MS_Art_Appreciation_6")

      if(x.value == true)

      {

        event.value = 'X';

      }

      else if(x.value == false){

        event.value = '';

      }

       

      In the first example, you can see I have an alert, and regardless if it is opened on the web, or in Acrobat, I get no alert box, which leads me to believe that the doc level scripts are not running on load.

       

      Any help would be appreciated as I am about to give up on this issue.  Thanks

       

      Disregard field names, there are several and I know they are different in the examples.