Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

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

$
0
0

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.


Viewing all articles
Browse latest Browse all 12130

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>