How to copy a value from one text box to another based on a checkbox?
I have an online app that generates a pdf form and gets the data from the database. When you open (download) the pdf, all the values are populated automatically (including the checkboxes). I have checkboxes and text boxes.
If the checkbox (HIS_HeartProb) is ticked and textbox1 (HIS_HeartProbDesc) is equal to YES, the value from textbox1 (HIS_HeartProbDesc) should be copied to textbox2 ( HIS_Details). I'm using the following javascript (onload):
var a1 = this.getField("HIS_HeartProb").value
var a2 = this.getField("HIS_HeartProbDesc").value
var a3 = "HEART PROBLEM: "
this.getField("HIS_Details").value = (a1 == "YES" && a2 != "") ? (a3+a2+" ") : "";
My problem is it's not copying the values into textbox2 (HIS_Details). It's also not able to check the correct value of the checkbox. When I open the downloaded pdf, all the checkboxes are converted into text/string and they are no longer checkboxes. the box is still there and there's still a check but you can't tick it anymore (not editable). I'm thinking that's the reason why it's not copying the values.
Can anyone please help me with this? Thanks.
