Skip to main content
boilermaker73
Inspiring
February 6, 2021
Question

Unable to display tick using bMarked property for this calculate menu item in javascript

  • February 6, 2021
  • 1 reply
  • 508 views

I have a popup menu created in acrobat javascript using the popUpMenuEx method that works flawlessly with exception of one issue I am having with the bMarked property for a menu item that acts as a toggle switch to turn calculations on/off. Although the menu item works without flaw performing its intended function, for whatever reason, I am unable to display a checkmark/tick next to the popup menu item using the bMarked property when this.calculate=true. I am just wondering if this has anything to do with the 'calculate' property. Has anyone ever experienced this behavior or know what may be causing this problem as I have never had an issue in creating similar popup menu items such as one to toggle 'highlight fields' on/off?  Thank you ahead of time.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
February 6, 2021

It should not be related. Can you post your code?

boilermaker73
Inspiring
February 7, 2021

Update. While I have since been able to toggle the tick on/off, for whatever reason all popup menu items display a tick when I am attempting to toggle the popup menu to switch calculations on/off and display/remove the tick at the same time. In reality, I'm going nuts in trying to resolve this issue. Hopefully, it's staring me right in the face. Here's the applicable code if it helps:

//code to create the popup menu item using popUpMenuEx

 if(objParent.cName=="Enable Auto Calc")
objParent.cReturn="AutoCalc";
objParent.bMarked=bAutoCalc;

 

//code to toggle calculations and associated tick on/off

 case "AutoCalc":
if(bAutoCalc==false){
this.calculate=true;
calculateNow();
bAutoCalc=this.calculate;
}
else{
this.calculate=false;
bAutoCalc=this.calculate;
}
break

 

//line of code to initialize var bAutoCalc under initialize()

bAutoCalc=this.calculate;

 

 

boilermaker73
Inspiring
February 7, 2021

Resolved. Deep down, I just knew it had to be something simple staring me right in the face. In reality, I either need glasses or have been staring at my bright laptop screen for too long without a break in which event I didn't realize that I had inadvertently deleted the left '{' and right '}' characters enclosing the menu item in the code that obviously didn't throw a syntax error. For anyone interested, here's the required correct code below to make this work as intended:

//code to create the popup menu item using popUpMenuEx

 if(objParent.cName=="Enable Auto Calc"){ 
objParent.cReturn="AutoCalc";
objParent.bMarked=bAutoCalc;

} missing character added

 

//code to toggle calculations and associated tick on/off

case "AutoCalc":
if(this.calculate==false){
this.calculate=true;
calculateNow();
bAutoCalc=true;
}
else{
this.calculate=false;
bAutoCalc=false;
}
break

 

//line of code to initialize bAutoCal

bAutoCalc=true;

 

Once the syntax was corrected, both the case and initialization code needed to be changed to get this to work. The amusing part is that no matter what I tried before, whether the code was correct or not in the case and initialization, it really didn't matter as long as the syntax in creating the popup menu was missing characters to begin with. I just cannot believe I did this. Embarrassing to say the least.