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

Custom JavaScript Help

$
0
0

I have 5 combo boxes with choices of Y, N and NA. When yes is selected the score will equal 3, when no is selected the score will equal 0, when NA is selected the score will show no score. I have a text box that will then show the final score from the 5 combo boxes, out of a possible 15. I have one last text field that will show a pass or fail. A pass would be 15 anything less than a 15 is a fail. I have custom JavaScript stating the following:

 

var aFields = new Array("6 Combo Box 1", "6 Combo Box 2", "6 Combo Box 3", "6 Combo Box 4", "6 Combo Box 5");

var aDefault = new Array();

for (var i = 0; i < aFields.length; i++){

     if (this.getField(aFields[i]).value == this.getField(aFields[i]).defaultValue){  //compares field value to default value which is empty

          aDefault.push(aFields[i]);  //this will create an array of fields not filled in

     }

}

 

var v = +this.getField("Model Call Score").value;

if (v>14) event.value = "Pass";

else event.value = "Fail";

 

 

//verify if aDefault contains at least one field

if (aDefault.length >0){

     event.target.display = display.hidden; 

//hide my value if a field is still empty

 

}

else{

     event.target.display = display.visible;

}

 

I understand that the last part of the code said to make the value hidden. I want a pass or a fail to show up only when all combo boxes are selected. I do not have knowledge of JavaScript. Could someone please help me correct my current code or come up with another suggestion. Attached is a link to my form. My above question is referring to the bottom section.


Viewing all articles
Browse latest Browse all 12130

Trending Articles



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