Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 90168

Re: Pre-filling a text box from a Radio Button selection

$
0
0

Hi,

 

I am used this same code in another form where I want to pre-fill a text box based on a radio button selection. ie. when the button with a value of " " is ticked nothing is pre-filled and the user writes their own text. When the button with the value "No" is ticked, some text appears in the text box.


It works fine for this purpose, however I need to be able to add to the pre-filled text and it does not allow me to do this. Is there anything I can do?

 

(function () {

 

    // Get a reference to the radio button group

    // and its value

    var f = getField("Outcome2A2");

    var v = f.valueAsString

    // Allow the user to enter text

    event.target.readonly = false;

    // Only set this field's value if a change in the radio button

    // is what triggered this script

    if (event.source && event.source === f)

        if (v !== "Off" && v !== " ") {

            event.target.readonly = true;

            event.value = "Blah blah blah";

        } else {

            event.value = "";

 

        }

 

    }

 

})();

 

Thanks.


Viewing all articles
Browse latest Browse all 90168

Trending Articles



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