
Copy link to clipboard
Copied
I have a question about radio buttons.
I've been searching the sea of the net for two days just following problem, but no hint has fallen anywhere.Please help me !!
=====
Based on a certain calculation, I would lile to make a javascript that automatically checks radio button.
The "true side radio button" if the result is true, and "false side radio button" if the result is false.
I don't get caught in debugging, and it doesn't appear alarm.
But it doesn't work.
========
First, I created a script that looks like this:
But it does not react at all.
var Ave1 = this.getField("Ave_1").value;
var Ave2 = this.getField("Ave_2").value;
var RadioAve = this.getField("Radio_Ave").value;
if (Ave1>=Ave2){
RadioAve[0].checked = true;}
else{RadioAve[1].checked = true;}
========
Next, I tried with the following script.
I created a separate button and placed the script there.
This also does not react.
var RadioAve = this.getField("Radio_Ave").value;
RadioAve[0].checked = true;
========
Lastly I tried it with a checkbox.
I created a separate button and placed the script there.
But this also doesn't respond.
var CheckAve = this.getField("Check_Ave").value;
CheckAve[0].checked = true;
========
Is this impossible with Acrobat DC?
Or is there a serious mistake in my code?
1 Correct answer
Hi
checkThisBox: Checks or unchecks the specified widget.
Only check boxes can be unchecked. A radio button cannot be unchecked using this method, but if its default state is
unchecked (see defaultIsChecked) it can be reset to the unchecked state using the resetForm. method of the Doc.
Copy link to clipboard
Copied
Radio buttons and check boxes doesn't have a property with the name "checked". Did you read the documentation?

Copy link to clipboard
Copied
Thank you very much. Sorry for the late reply. I am Japanese and have a time difference with you. Besides, I am not good at English. Please understand.
There is no Japanese document regarding the handling of JavaScript in Adobe products. Unfortunately, there aren't enough personal blogs to explain it.
Japanese documents related to JavaScript processing in Adobe products are not provided by Adobe.
Unfortunately, there isn't personal blog to explain it complatery. In other words, almost or people has gave up handling already. Even if I ask a question on a Japanese consultation site, no one will answer the consultation on JavaScript in Adobe PDF. No one can answer it.
The first thing that everyone will notice immediately is that the JavaScript properties and other aspects of manipulating Adobe PDF are very different from those for creating web pages.
For example, the "checked" I used here is very commonly used in JavaScript for manipulating web pages.
However, there is no Japanese document that can understand the difference, so almost everyone gives up. Even books are not sold.
So I'm looking for English documents, but it's hard to hit in Japanese Google at here.
Could you please introduce a page that summarizes the properties for Adobe PDF in an easy-to-understand manner?
Copy link to clipboard
Copied
Hi
checkThisBox: Checks or unchecks the specified widget.
Only check boxes can be unchecked. A radio button cannot be unchecked using this method, but if its default state is
unchecked (see defaultIsChecked) it can be reset to the unchecked state using the resetForm. method of the Doc.

Copy link to clipboard
Copied

