Skip to main content
anthiam15561249
Participant
May 20, 2026 5:21 AM UTC
Question

Need a javascript form field to populate a checkbox answer to another page

Form field

I need a javascript to populate the text of a checkbox onto another page. For example, there will be a ‘yes’ checkbox, ‘no’ checkbox and ‘dont know’ checkbox. When a user clicks on the checkbox, the answer (for eg. ‘Yes’) will be autopopulated onto another page in the same pdf.

For example:
___ ‘yes’     ___’No’   ___’don’t know

When ‘yes’ is checked, the word ‘yes’ will appear in another page text field. 

    3 replies

    Nesa Nurani
    Community Expert
    Community Expert
    May 20, 2026 6:45 AM UTC

    What are the names of checkboxes and text field?

    Translate
    anthiam15561249
    Participant
    May 21, 2026 4:09 AM UTC

    The name of the 3 checkboxes are Y1, N1, DK1 (form field)

    The text for the 3 checkboxes are Yes, No and Don’t know.
     

    If user checks ‘Yes’, I would like the word ‘Yes’ appear on the next page question. (so auto populate the chosen answer)

    Translate
    Nesa Nurani
    Community Expert
    Community Expert
    May 21, 2026 4:52 AM UTC

    In the text field where you wish answer to show, go to properties, select calculate tab and as ‘Custom calculation script’ use this:

    var f = this.getField.bind(this);

    event.value =
    f("Y1").valueAsString !== "Off" ? "Yes" :
    f("N1").valueAsString !== "Off" ? "No" :
    f("DK1").valueAsString !== "Off" ? "Don't know" : "";

     

    Translate