dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: radio button value

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Location
    New Zealand
    Posts
    271

    radio button value

    Greetings

    I'm trying get the value of a radio button group, ie, return the value of the selected radio button.

    have tried the following:

    PHP Code:
    radioGroup.data
    radioGroup
    .selection
    radioGroup
    .selected 
    but nothing is returning the value of the selected radio button.

    Have also tried



    thanks
    PHP Code:
    if (_root.radioQuestion == "yes") {
    myAnswer "yes";
    } else {
    myAnswer "no";

    PHP Code:
    if (radioQuestion.selectedData == "yes") {
    myAnswer "yes";
    } else {
    myAnswer "no";

    PHP Code:
    if (radioQuestion.selection.data == "yes") {
    myAnswer "yes";
    } else {
    myAnswer "no";

    but nothing is working.

    Can anyone tell me how to trace the value of the selected radio button?

    thanks
    Last edited by Bapha; 05-03-2005 at 08:58 PM.

  2. #2
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    code:

    var radioListener={};

    radioListener.click=function(evt){
    trace("Selection: "+evt.target.selection);
    trace("Data: "+evt.target.selection.data);
    trace("Label: "+evt.target.selection.label);
    }

    radioGroup.addEventListener("click",radioListener) ;



    HTH,

    K.

  3. #3
    Senior Member
    Join Date
    Sep 2000
    Location
    New Zealand
    Posts
    271
    thanks.

    that works, however, what I am trying to still isnt working.

    I have a form, with a number of components.

    I'm trying to add the values of the various components (ie textfields, radiobuttons etc) to an array.

    and the submit button fires a trace function which traces all the entered values of the components.

    heres my code, with the associative array.


    PHP Code:
    //RadioButtons
    /*
    if (_root.radioQuestion.getValue() == "yes") {
    myAnswer = "yes";
    } else {
    myAnswer = "no";
    }*/

    var radioListener={};
    radioListener.click=function(evt){
    //trace("Selection: "+evt.target.selection);
    //trace("Data: "+evt.target.selection.data);
    //trace("Label: "+evt.target.selection.label);
    }
    radioQuestion.addEventListener("click",radioListener);

    fcArray = new Array();
    fcArray["product_id"] = product_id.text;
    //client_id
    fcArray["client_id"] = "freedom";
    //oneway or return
    fcArray["oneway"] = evt.target.selection.data;
    //dates
    fcArray["end_date"] = end_date.selectedDate ;
    fcArray["current_date"] = current_date.selectedDate;
    fcArray["start_date"] = "20050530";
    fcArray["days_away"] = days_away.value;
    fcArray["warning_period"] =warning_period.value;
    //Pax
    fcArray["adults"] = adults.value;
    fcArray["children"] = children.value;
    fcArray["infants"] = infants.value;
    //session
    fcArray["session_id"] = "DE8C7D2A8905D05EAC988055F7AC258B";
    fcArray["cookie"] = "localhost_e6fjhvo7";

     
    //Trace function - fired onClick.
    function doTrace():Void
    {
    for(var 
    key in _root.fcArray){
        
    trace(key " >> " _root.fcArray[key]);
        }

    any idea why it isnt working?

    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center