How do you show/hide buttons based on calculated result
Hi,
I'm struggling with this; hopefully someone can help.
I'm creating a PDF that has some questions that are radio buttons with numeric values on each one. I'm wanting the sum of those selected to show a particular button - the result.
I've done something similar in the past, however that just populates a field with predefined text and colours the box - in this instance I'm wanting to show/hide a button as I was hoping to do a graphical answer as opposed to just words.
Here's the script I'd use previously:
var nResult = this.getField(“XXXXXX”).value;
if ( nResult > 14 ) {
event.value = “XXXXXXX”;
event.target.textColor = ["RGB", 1, 1, 1];
event.target.fillColor = ["RGB", 0, 0.454902, 0.482353];
}
else if( nResult > 7 ) {
event.value = “XXXXXXX”;
event.target.textColor = ["RGB", 0.113725, 0.113725, 0.105882];
event.target.fillColor = ["RGB", 1, 0.780392, 0.345098];
}
else {
event.value = “XXXXXXXXX”;
event.target.textColor = ["RGB", 0.113725, 0.113725, 0.105882];
event.target.fillColor = ["RGB", 0.937255, 0.262745, 0.219608];
}
Can this be done? any help would be hugely appreciated.
Huge thanks in advance
