Skip to main content
Participant
September 18, 2024
Question

RadioButton Javascript click event not working for a PDF in TCPDF

  • September 18, 2024
  • 1 reply
  • 327 views

If anyone can help, I'd appreciate it. I have created a simple form using TCPDF. The javascript for the click event for a radiobutton control is not working. I'd like to fill the text box with the value of the checked radio button. There are 4 radio buttons 

 

My code so far is:

 

To display the radiobutton controls:

$pdf->RadioButton('r_zcct', 5, array(), array(), '27', true, $x, $y, false);
$pdf->RadioButton('r_zcct', 5, array(), array(), '30', true, $x, $y, false);
$pdf->RadioButton('r_zcct', 5, array(), array(), '35', true, $x, $y, false);
 

To display the target textbox control:

$pdf->TextField("textbox_1", 30, 3, array(), array(), $x, $y);
 
The text field does get the default value of the radio buttons with this javascript:
this.getField("textbox_1").value = this.getField("r_zcct").valueAsString;
 
I just don't know how to code the javascript to detect when a different radio button is checked and then fill the textbox with the radio button's value.
 
I tried everything like if(this.getField("r_zcct").isChecked){}, but nothing seems to work. 
 
Thank you for all your help.
 
This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
September 18, 2024

It's very likely this application doesn't support the full JS specs. There's nothing we can do about that. Complain to its developers.