Quantcast
Channel: Adobe Community: Message List - PDF Forms
Viewing all articles
Browse latest Browse all 57214

Re: Using radio buttons to populate a text field

$
0
0

If you set the export value (aka Button Value, Radio Button Choice) of each radio button to the text you want to show up in the text box, the custom calculate script for the text box, which you should set to read-only, can be simply:

 

(function () {

 

    // Get the value of the radio button group, as a string

    var s = getField("Ethnicity").valueAsString;

 

    // Set this field's value to the text associated with the selected radio button

    event.value = s === "Off" ? "" : s;

 

})();

 

 

If none of the radio buttons is selected, the text field will be blank. Change "Ethnicity" above to the actial name of the radio button group.


Viewing all articles
Browse latest Browse all 57214