I am currently creating a form, which some questions are not required unless a particular answer is selected, So I am hoping to have the optional questions hidden from layout until an answer is selected and if the question is needed it will become visible. This has been fine, but I realised that if someone wants to print out the form to fill it out, obviously those hidden questions are not printed. So I started adding a script in the event "prePrint" for each hidden field - this.presence = "visible";
Which seemed to be working. Until i came to a text field I have used as a "Caption/Question Title" for checkboxes.
// The below is currently Hidden (excluded from layout)
Example Question 2 o Answer 1 o Answer 2 o Answer 2
I can get Answer 1, 2 & 3 to print (with their checkboxes) but the text field I used to write the question in, won't let me put a script in any event. Is this something that is just not possible? Or am I doing something wrong?
I would also like to know if there is a much simpler way to just have all hidden fields visible when printed? Or if it is just adding to each event in each field like I have been?
Make Example Question 2 a TextField. You will then be able to change it's rawValue to whatever you need based on the checkbox selection. Change the caption Position to None in the layout tab and add the text in the object/value default text field.
I have also protected the TextField so the text can't be user changed.
This code effectively makes checkboxes work like radio buttons, only one can be checked at a time.