Dynamic radio button and group

Hi, we have create dynamic radio button and group on “application creation complete” event , but which I am try to get number of radio button its show zero, see below code
import flash.utils.setTimeout;
import mx.controls.Alert;
import mx.events.FlexEvent;
import spark.components.RadioButton;
import spark.components.RadioButtonGroup;
private var  rbg:RadioButtonGroup;
private var  rb1:RadioButton;
private var  rb2:RadioButton;
private var dcount:int = 0;
protected function application1_creationCompleteHandler(event:FlexEvent):void
     // TODO Auto-generated method stub
     // TODO Auto-generated method stub
     rb1 = new RadioButton();
     rb2 = new RadioButton();
     rbg = new RadioButtonGroup();
     rb1.label = "Radio1";
     rb2.label = "Radio2";
     rb1.group = rbg;
     rb2.group = rbg;
     vbox1.addChild(rb1);
     vbox1.addChild(rb2);
     checkRadioButton (); 
protected function checkRadioButton ():void
     Alert.show("In checkRadioButton function : " +  rb1.group.numRadioButtons.toString());
If I put some Time interval to call  checkRadioButton function its working fine,
//checkRadioButton (); 
setTimeout(checkRadioButton,1000);
but this is not best practice.
why this happen ….can anybody  clear  this or any other way to do this.
Thanks in advance

@manjeet.patel,
Just write the below line of code
vbox1.validateNow();
You need not use setTimeout() function
vbox1.addChild(rb1);
vbox1.addChild(rb2);
vbox1.validateNow();
Thanks,
Bhasker

Similar Messages

  • Radio button and group

    Hi All,
    Not quite follow what dev guide says about radio button and group implementation.
    I tried but always got strange behavior.
    I have a subtab with two radio buttons (rbt1 and rbt2)
    rbt1 property defined as:
    Initial Value: Y
    Checked Value: Y
    Unchecked Value: N
    rbt2 property defined as:
    Initial Value: Y
    Checked Value: N
    Unchecked Value: Y
    Also, In my subtab PR, I init these two bts as a group:
    OAMessageRadioButtonBean colButton1 =
    (OAMessageRadioButtonBean)webBean.findChildRecursive("rbt1");
    colButton1.setName("colGroup");
    colButton1.setSelectedValue("Y");
    OAMessageRadioButtonBean colButton2 =
    (OAMessageRadioButtonBean)webBean.findChildRecursive("rbt2");
    colButton2.setName("colGroup");
    colButton2.setSelectedValue("N");
    When the subtab render first time, rbt1 is checked and rbt2 is unchecked as expected. but when I go to other subtab then come back, the rbt1 is unchecked and rbt2 is checked (switch automatically).
    The subtab PR is the only place I set this radio button value and group as showing above. Somewhere wrong with my logic or setting?
    Regards,
    KJ

    Hi All,
    Got issue resolved. When I was replying Ranjit previous post, I mentioned both of buttons bind to same VO attribute. Since the first rbt1 has defined checked and unchecked values (Y & N) and both of buttons are defined in same group, so I took off second rbt2 attribute binding then it works (won't switch automatically anymore).
    I still defined init values for both of buttons and also removed setSelectedValue() method calls from PR.
    Thanks again for the great helping.
    KJ

  • Creating dynamic Radio Buttons and Buttons

    Hello All,
    Presetly I am working on below functionality:
    I have an ArrayCollection which is like
    var sampleCollection:ArrayCollection = new ArrayCollection( [ {"filterID:1", filterName:"Occupied" },  {"filterID:2", filterName:"Unccupied" }] );
    Now my requirement is to create a RadioButton  and a Normal Button for every element in the ArrayCollection.
    So basically the UI will be "RadioButton, Occupied, Button, Button".
    Can someone help me in this respect.
    Thanks in advance,
    Nirmal Kumar Bhogadi.

    HI Nirmal,
    If u want to create the radiobuton and abutton according to the arraycollection data then u follow the following principle.
    Take a vbox. this is contains all the rasio button.
    then do a loop to the arraycolection upto it's length.
    and create the the radio button and add into vbox;
    ex
    <mx:Vbox id ="container"/>
    script:-
    privare var aa:arrayCollection =  ur arraycollection;
    private function addChild():void
         for(var i:int=0; i<aa.length; i++)
              container.addchild(new radioButton());
    I think this hint will help u. if u get ur answer please give me points
    Thanks
    Niranjan Swain

  • Dynamic radio button and retreving data

    Ineed help with this. On my JSP i dinammicaly create radio buttons.
    <c:forEach items="${ScoringTestForm.scCategoryRs.rows}" var="ctg" varStatus="statusCtg">
    <c:out value="${ctg.DESCR}" />
    <c:forEach items="${ctg.SCORINGITEM_RS.rows}" var="item" varStatus="statusItem">
    <c:out value="${item.LABEL}" />
    <c:forEach items="${item.SCORINGITEMVALUE_RS.rows}" var="itemVal" varStatus="statusItemVal">
    <c:set var="ivalcnt" value="${ivalcnt + 1}" />
    <input type="radio" id='rb<c:out value="${ivalcnt}" />' name='type<c:out value="${itemVal.IDSCITEM}"/>' value='<c:out value="${itemVal.VALUE}" />' >
    <label title='<c:out value="${item.LABEL}" />' for='rb<c:out value="${ivalcnt}"/>' ><c:out value="${itemVal.LABEL}" /></label>
    </c:forEach>
    </c:forEach>
    </c:forEach>
    this code creates multiple radio buttons with different names (type1, type2.....).How can i get the values from the radio buttons to my form bean. The radio buttons are populated from Rs objects witch contain Value objects. Thx

    @manjeet.patel,
    Just write the below line of code
    vbox1.validateNow();
    You need not use setTimeout() function
    vbox1.addChild(rb1);
    vbox1.addChild(rb2);
    vbox1.validateNow();
    Thanks,
    Bhasker

  • Dynamic radio button issues.

    Hello;
    I changed around the way I do a contact form from one page loading onto another to just one page. I had my radio buttons working the 2 page way, but now, it throws an error and says that the TYPE is undefined in the form. The type is the name of my group of radio buttons. Here is what I'm doing, can someone help me fix this so a form will remember if it has to be reloaded what radio button you chose?
    My code:
    <cfform action="#cgi.script_name#" method="post">
    <cfif form.type EQ 'male'>
    <input name="type" type="radio" onClick="setVisibility('sub3', 'inline');setVisibility('sub4','none');setVisibility('sub5','none');" value='male' checked="checked"/>
    <cfelse>
    <input name="type" type="radio" onClick="setVisibility('sub3', 'inline');setVisibility('sub4','none');setVisibility('sub5','none');" value='male'/>
    </cfif>
    <cfif form.type EQ 'female'>
    <input type="radio" name="type" value='female' onClick="setVisibility('sub3', 'none');setVisibility('sub4','inline');setVisibility('sub5', 'none');" checked="checked"/>
    <cfelse>
    <input type="radio" name="type" value='female' onClick="setVisibility('sub3', 'none');setVisibility('sub4','inline');setVisibility('sub5', 'none');"/>
    </cfif>
    <cfif form.type EQ 'child'>
    <input type="radio" name="type" value='child' onClick="setVisibility('sub3', 'none');setVisibility('sub4','none');setVisibility('sub5', 'inline');" checked="checked"/>
    <cfelse>
    <input type="radio" name="type" value='child' onClick="setVisibility('sub3', 'none');setVisibility('sub4','none');setVisibility('sub5', 'inline');"/>
    </cfif>
    those are the 3, I need this form to remember your choice, they control parts of the form. The if statement is throwing the error, this is the error:
    Element TYPE is undefined in FORM.
    The error occurred in C:\quoteReq.cfm: line 282
    Called from C:\Websites\187914kg3\quoteReq.cfm: line 276
    Called from C:\Websites\187914kg3\quoteReq.cfm: line 275
    Called from C:\Websites\187914kg3\quoteReq.cfm: line 260
    Called from C:\Websites\187914kg3\quoteReq.cfm: line 1
    280 :                 <span class="contactText">Select the type of project to get a quote.</span><br>
    281 :                 <br>
    282 :                 <input name="type" type="radio" id="type" onClick="setVisibility('sub3', 'inline');setVisibility('sub4','none');setVisibility('sub5','none');" value='male' <cfif form.type EQ 'male'>checked="checked"</cfif>/>
    283 :                 <span class="contactText">Magnets</span>
    284 :                 <input type="radio" name="type" id="type" value='female' onClick="setVisibility('sub3', 'none');setVisibility('sub4','inline');setVisibility('sub5', 'none');" <cfif form.type EQ 'female'>checked="checked"</cfif>/>   
    Can anyone help me fix this please?

    My code for this simple action is looking really nasty at this point. I agree with making this neater, it controls a lot on this page. It's a problem in the java script, let me show you how this is set up:
    if you click on a radio button (step 1 in the form) it changes a spot in the site (div tags) to your selection. I'm stripping this down to just the java right now, then add in logic to it.
    this is my java, but It's not working right now even strait up with no coldfusion involved.
    <script language="JavaScript">
    function setVisibility(id, visibility) {
    document.getElementById(id).style.display = visibility;
    </script>
    <style type="text/css">
    .showHide {
    position: absolute;
    background-color: #f1f1f1;
    width: 300px;
    padding: 1px;
    color: black;
    border: #999999 2px dashed;
    display: none;
    </style>
    <input name="type" type="radio" onClick="setVisibility('sub3', 'inline');setVisibility('sub4','none');setVisibility('sub5','none');" value='male' checked="checked"/><span class="contactText">Magnets</span>
    <input type="radio" name="type" value='female' onClick="setVisibility('sub3', 'none');setVisibility('sub4','inline');setVisibility('sub5', 'none');"/><span class="contactText">Paper Steel</span>
    <input type="radio" name="type" value='child' onClick="setVisibility('sub3', 'none');setVisibility('sub4','none');setVisibility('sub5', 'inline');"/> <span class="contactText">Both</span>
    my div tags
    <div id="sub3" class="showHide" style="display:inline;">div one content here</div>
    <div id="sub4" class="showHide">div 2 content here</div>
    <div id="sub5" class="showHide">div 3 content here</div>
    right now, this isn't functioning as is. I had it working, until I redid my form approach in programming. Now I need to rethink this. What I'm trying to do is this.
    first, get this script working again. then, once it's swaping out div tags, I need it to remember what radio button you clicked so that respective div tag stays open on page reload of any errors from required fields. f I click on a radio button and send the form with now required fields, it brings up the proper div. I also went with the structkeyexists approach and it kind of helped me, but it's making my code really big and messy going this road.
    any ideas on how to approach this problem? starting with this broken script.
    Right now, there is not dynamic interaction, but i

  • Radio button and select option in one line

    Hi,
    I have an requirement in which i need to display the radio button and select option in one line in an report program.
    How can i do it? 
    Regards,
    Arun.

    Hi,
    Try this code.
    TABLES: bkpf.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: p_r1 RADIOBUTTON GROUP a.
    SELECTION-SCREEN COMMENT 4(20) text-001 FOR FIELD p_r1.
    SELECTION-SCREEN COMMENT 30(12) text-002 FOR FIELD p_date.
    SELECTION-SCREEN POSITION 39.
    SELECT-OPTIONS: p_date FOR bkpf-budat OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS: p_r2 RADIOBUTTON GROUP a.
    text-001 = " Radio button"
    text-002 = "Posting date"

  • How can i get Radio buttons  and parameters  in a Single Straight Line

    Hi Experts,
    How can i get Radio buttons  and parameters  in a Single Straight Line...
    Example:
       r1 r2 p1 p2.....
    Cheers,
    Priya
    Points granted.

    Write the following code for the selection screen:
    DECLARATION OF PARAMETERS.
    SELECTION-SCREEN: BEGIN OF BLOCK select WITH FRAME TITLE text-001,
                      BEGIN OF LINE.
                      SELECTION-SCREEN COMMENT 1(10) FOR FIELD p_detail.
                      PARAMETERS p_detail RADIOBUTTON GROUP r1 DEFAULT 'X'.
                      SELECTION-SCREEN COMMENT 25(10)  FOR FIELD p_summry.
                      PARAMETERS p_summry RADIOBUTTON GROUP r1.
    SELECTION-SCREEN: END OF LINE,
                      END OF BLOCK select.
    this will solve your poblem surly. reward the points if you find helpful
    Regards,
    Siddarth

  • Dynamic radio button in web dynpro abao

    Hi expert,
    I want to dynamic radio button by  web dynpro abap .
    Kindly give me a soulation ASAP.
    Thanks and regard's
    Vikash

    hi,
    method wddomodifyview .
    if first_time eq abap_true.
    data: LR_CONTAINER         type ref to CL_WD_UIELEMENT_CONTAINER,
          LR_RADIOBUTTON1            type ref to CL_WD_RADIOBUTTON,
          LR_RADIOBUTTON2            type ref to CL_WD_RADIOBUTTON,     
          LR_FLOW_DATA         type ref to CL_WD_FLOW_DATA.
    " bind text property will give TEXT that appears next to Radio Button
    CALL METHOD cl_wd_radiobutton=>new_radiobutton
      EXPORTING
       bind_selected_key   =  '01' 
       BIND_TEXT           =  'saurav'
      receiving
        control             = LR_RADIOBUTTON1.
    " bind text property will give TEXT that appears next to Radio Button
    CALL METHOD cl_wd_radiobutton=>new_radiobutton
      EXPORTING
        bind_selected_key   = '02'
       BIND_TEXT           = 'mago'
      receiving
        control             = LR_RADIOBUTTON2.
    LR_FLOW_DATA        =  CL_WD_FLOW_DATA=>NEW_FLOW_DATA( element = LR_RADIOBUTTON1  ).
    LR_FLOW_DATA        =  CL_WD_FLOW_DATA=>NEW_FLOW_DATA( element = LR_RADIOBUTTON2  ).
    LR_CONTAINER ?= view->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER' ).
    LR_CONTAINER->ADD_CHILD( LR_RADIOBUTTON1  ).
    LR_CONTAINER->ADD_CHILD( LR_RADIOBUTTON2  ).
    endif.
    endmethod.
    Thanx.

  • Reg: radio button and parameters usage

    Hi,
       If there are 3 radio buttons and 1 parameter, and if i click one radio button then the parameter must be a mandatory, if i click the remaining radio button the parameter must be a normal one( Not mandatory).
    give me clear picture to solve it, as soon as possible,
    thanks in advance

    Hi,
    Wanna try this...??
    PARAMETERS: p_exp RADIOBUTTON GROUP radi,
                p_imp RADIOBUTTON GROUP radi,
                p_clear RADIOBUTTON GROUP radi.
    PARAMETERS: path(30)    TYPE c .
    at selection-screen.
                if p_exp = 'X'.
                 if path is initial.
                  message 'Enter clear' type 'E'.
                endif.
                endif.
    Solves ur problem!!
    Have Fun!!
    Ira!!

  • Check boxes, Radio Buttons, and XML Field Order

    I am working with Adobe Designer Version 7.0. Hopefully this forum can still address my issues.
    I am creating a registration form that will often be submitted via email to us for processing. To help make the data both easy to transfer for us into our excel file  and to minimize the errors made by the people using the form, I need the form to be able to do a couple of things that I am having a hard time figuring out. My questions are the following:
    I have a list of 7 check boxes that each insert a dollar value into a seperate numeric field on the form. Each check box has a unique dollar value associated with it. Is there any way to design the form so the user can only choose one of the check boxes? I tried using radio buttons in a group, but if a user mistakenly chose the wrong radio button and then selected another button from that group, it would add to the total in the Application Fee field and not subtract out the previous amount. Below is the code i used for one of the check boxes.
    I have two numeric fields that the user must choose one or the other. Can I design those two fields (numHomes and numBuildings) so that if the you enter a value for one field, you cannot enter a value for the other field? Both fields are then calcuated in a seperate numeric field. Below is the code i used for the numeric field.
    I want to be able to take the data emailed to us as an XML file  when a user submits the results via email and directly paste it into our Excel file. To keep the cut and paste process simple, I want to make sure the order of the XML fields matches the order of the database fields so it can be done in one shot. Do you know how to organize the XML fields? They do not seem to correspond to the ordering found under the Hierarchy tab. Any thoughts on this?
    Thanks
    if (this.rawValue == 1) then
           numAppFee.rawValue = numAppFee.rawValue + 350;
    else
           numAppFee.rawValue = numAppFee.rawValue - 350;
    endif
    numHomes * 50 + numBuildings * 100 + numDups * 10

    Create an XML Schema (XSD) and define that as the default form schema. The form data will conforms to the order of fields defined in the XML schema.
    Hope that helps.
    Nith

  • Help with radio buttons and show/hide javascript

    Hi. I'm new working with LiveCycle and also pretty much at a basic/beginner level of javascripting. I'm creating a pdf fillable form and one of the tasks I've been given is to add a function where if Option A is chosen by the user, then the correspondng table will appear, and if Option B is chosen another table will appear. After some searching I Iearned more about how radio buttons can be used, so I created a set of radio buttons. I have tried several different things, the latest was making both tables "hidden", and then taking to the radio button list group and applying the show/hide script to each of the radio buttons in the group. Still nothing seems to be working as I want it to. The table remains hidden when I click on the . This is what the code looks like right now. I know I'm obviously doing something wrong, this seems like such a basic thing to code. Getting to the frustration point, if you can sort me out with what I am missing/overlooking please let me know. Many thanks!
    Note. The radio buttons are not in the same table, they are higher up in the form outside of the tables that I am trying to show/hide, but they are in the same subform. I don't know if that might be an issue?
    form1.#subform[0].RadioButtonList::click - (JavaScript, client)
    form1.#subform[0].RadioButtonList.#field[0]::click - (JavaScript, client)
       if ( RadioButtonList.#field[0].selectedIndex == 1)
         form1.#subform[0].Table1_Work.presence = "visible"
       else
       form1.#subform[0].Table1_Work.presence = "hidden"
    form1.#subform[0].RadioButtonList.#field[1]::click - (JavaScript, client)
       if ( RadioButtonList.#field[1].selectedIndex == 2)
        form1.#subform[0].Table1_Official.presence = "visible"
      else
         form1.#subform[0].Table1_Official.presence = "hidden"

    Hi,
    For starters you have unnamed pages, which is not a good idea. This makes it more difficult to reference objects. In your JavaScript you would have to resolve the node, however the simpliest route would be to name the page first. Something like "page1". Have a look at this example for referencing objects: http://assure.ly/kUP02y.
    Next I would not place the script in each of the radio buttons, as this is likely to cause conflicts and is doubling the script. The best place to put the script is in the click event of the radio button exclusion group. This contains all of the radio buttons. See an example here: http://assure.ly/h7whb8 and https://acrobat.com/#d=ALebgueDXjewHjGyYRdrmw.
    You syntax for JavaScript if/else statements is potentially incorrect. The script within the statements should be wrapped in curly brackets. While you can get away with it for single lines, I would not be inclined to take that approach. So:
    if (a test) {
         // do something
    else {
         // do something else
    With the radio button exclusion group you can use its rawValue, just specify it in the Object > Binding palette. So on the basis of chaning the page name:
    if (this.rawValue == "1") {
         page1.Table1_Work.presence = "visible";
    else {
         page1.Table1_Work.presence = "hidden";
    There is a syntax checker button in the Script Editor that should highlight errors.
    Niall

  • Position  for dynamic radio button

    Hi expert,
    i created a dynamic radio button in my web dynpro application but i want to give the position in top of the my view kindly give me on example for this issue.
    thank's and regard's
    vikash

    Use this.............
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/201ddd3b-b4ce-2b10-8883-880ae8147f89
    The sequence to place a new UIElement at the screen is as follows:
    1.Create the UIElement
    2.Create the LayoutData that fits to the Layout of the surrounding container
    3.Insert the UIElement into the surrounding container
    *Code to create new button dynammically:
    lr_button = cl_wd_button=>new_button( on_action = `CHANGE_TEXT` ).
    **The following coding changes the design of a button to "emphasized":*
    lr_button->set_design( cl_wd_button=>e_design-emphasized ).
    set the new text*
      lr_button->set_text( new_text ).
    For Step 2 and Step 3 refer code by Radhika.
    Thanx.
    Saurav.

  • Sets of Radio buttons all grouped together

    I am creating a form with many sets of radio buttons. Each set contains 3 buttons. When I add the 4th button, Designer groups it with the first three. When I add a 5th button, it is automatically grouped with the first 4. I need to separate the buttons into groups of 3. How do I manually choose which radio buttons to group together?
    Eric

    Doing this is little tricky... Add all your radio buttons and then choose all the ones you want to group in a different set holding Ctrl key. And then click your mouse button (right). Then choose 'Wrap in New Radio Button Group'.
    Good luck,
    SekharN.

  • How to create popup window with radio buttons and a input field

    Hi Guys,
    Can somebody give some directions to create a stand alone program to create a window popup with 2 radio button and an input field for getting text value. I need to update the text value in a custom table.
    I will call this stand alone program from an user exit. 
    Please give me the guidance how go about it or please give any tutorial you have.
    Thanks,
    Mini

    Hi,
    There are multiple aspects of your requirements. So let's take them one at a time.
    You can achieve it in the report program or you can use a combination of the both along.
    You can create a standalone report program using the ABAP Editor (SE38). In the report program you can call the SAP Module pool program by CALL Screen <screen number>. And then in the module pool program you an create a subscreen and can handle the window popup with 2 radio button and an input field for getting the text.
    For help - Module Pool programs you can search in ABAP Editor with DEMODYNPRO* and you will ge the entire demo code for all dialog related code.
    For Report and other Module pool help you can have a look at the following:
    http://help.sap.com/saphelp_nw70/helpdata/en/47/a1ff9b8d0c0986e10000000a42189c/frameset.htm
    Hope this helps. Let me know if you need any more details.
    Thanks,
    Samantak.

  • Radio button and associated functionality is not working!

    Hi Pros,
    I am facing the following problem:
    1.I have an interactive PDF created in Acrobat 9 Pro.
    2.PDF have few radio buttons, each radio buttons ahave assigned valus(eg: 1,2,3 etc)
    3.I have a text box in which the value of selected radio button is displayed.
    4.PDF is working fine on my machine.
    5.Client is having Internet Explorer version 7.0.5 and Adobe reader:8.2.6
    6.The radio buttons and associated functionality is not working on client's machine.
    7.The text box shows '0' even if we a radio button with value 2 or 1 is selected.
    What will be the problem? How can I fix this issue?
    Please help.

    Thanks alot for helping me on this.
    Thanks to u also ~graffiti

Maybe you are looking for

  • Localconfig is not found out in the new grid Oracle_HOME

    Hi There, Ifollowed the metalink Note ID 736121.1 to upgrad ASM for Non-RAC from 10gr2 to 11gr2. The 11gr2 Grid installation is successful, which is on a different directory from the current ASM directory. What I did for insallation is software only

  • Olympus E-P1 Support / Lens Corrections?

    Hey there, I recently picked up an Olympus E-P1 with the 14-42mm lens.  I updated to ACR 5.5, so now Lightroom and Bridge can open the RAW files (ORF format).  The Adobe DNG converter also works on those files. However, none of these result in correc

  • Account hacked and credit card charged!!!

    I received today 3 emails from Skype. one about Skype Manager, one about Auto-Recharge and a last one about an order for 10 euro that has been made with my credit card. In my account info I fount a strange primary email address @ 163.com [hyperlink r

  • How to setup airport express with time machine

    just bought airport express so i can extend my wifi range,can anybody help on how to set up! I have time machine 2gb, my house is wired with cat6 cable in all the bed rooms, but now only half my house get wifi,so i want to extend it.I know i have to

  • CallableStatement UnsatisfiedLinkError

    I am making a function call to an oracle package/function that is returning a value. I am getting at the execute statement an UnsatisfiedLinkError on oracle.jdbc.oci8.OCIDBAccess.copy_value_from_binds(Native Method). I am using an 8i driver for Oracl