Quantcast
Channel: Adobe Community : Unanswered Discussions - Acrobat
Viewing all articles
Browse latest Browse all 73766

Auto populate address field from 2 radio button choices

$
0
0

Hi

 

I have 2 radio buttons title "London" and "Manchester". They are in a group called "locale" so that only one of the radio buttons is able to be active at any one time.

What I am struggling to code is a text field called "OfficeAddress" that auto populates with the relevant address for the radio button choice. The actual addresses to be pulled into the "OfficeAddress" field are stored in two text boxes that will be hidden from view in fields called "hidLondon" and "hidManch"... though if these addresses can be incorporated into the javascript to avoid additional hidden text boxes, that's fine.

 

The code I have so far is below though this only seems to check the overall value for the group and not which radio button is actually selected.

 

// Custom Calculate script for hidden text field
(function () {     // Get the value of the radio button group (will be either Yes or No)    var v1 = getField("locale").value;     // Get references to the check boxes    var f2 = getField("CBCAddress");     // Set the check boxes, depending on the value of the radio button    if (v1 === "Yes") {        f2.value = getField("hidLondon").value;    }elseif (v1 === "No") {        f2.value = getField("hidManch").value;     }})();

 

Any assistance is gratefully received.

Many thanks


Viewing all articles
Browse latest Browse all 73766

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>