How to display Radio buttons with default selection on

Hi
I want to display Radio buttons using jsf
i have done it using
<h:dataTable id="apartmentList" value="#{userBean.allApartmentList}"
               var="apartments">
               <h:column>
                    <h:selectOneRadio id="selectedApartment" onclick="javascript:setSelectedApartment(this);">
                         <f:selectItem itemValue="#{apartments.apartmentVO.apartmentId}" />
                    </h:selectOneRadio>
               </h:column>
inside a data table
now when i click some page i want to display the radio's with default radio button selected
also when i select one radio button and click on some command button
eg:<h:commandButton action="#{userBean.setSelectedApartment}"
the Radio button's Selection should not disappear
i have written a javaScript
function setSelectedApartment(oRadio)
          oForm = oRadio.form;
          elems=oForm.elements;          
          for(iIndex=0;iIndex<elems.length;iIndex++)
               if(elems[iIndex].type == 'radio')
                    if(elems[iIndex].name != oRadio.name)
                         elems[iIndex].checked=false;
          document.getElementById("apartmentListForm:selectedApartmentId").value=oRadio.value;
To check which Raio button is Selected
How do i show the Default Selected button and How the selection should not disappear
Can any one suggest me links or the solution to this problem
Thank you
Geetanjalee

-set the value binding expression of select items to a request scope bean
- on the page load event() ,do
setdefaultval("ur default value")
so each time on the page load it sets the default value. and you can get selected value by getdefaultval()
--raju                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • [Flex 4.5.1] How to prevent Radio Button from being selected when clicked on? No Changing Event?

    I have a very common use case where you have a few radio buttons and only one can be selected at a time. Some of them are basic and on click should be selected right away, but other are more complex and open a pop up which requires some additional user selections after which the user selected OK or CANCEL for example and only after that the selection of the radio button should be applied programatically.
    So to solve this issue I've come up with 2 workarounds:
    1) make the entire group, that holds the radio button, act as a button with buttonMode="true" mouseChildren="false" and programatically change the radio button within it.
    2) hold the current radio button selection in a variable and in the changeHandler of that radio button return the selection back to what was selected before. But this also causes a small flickering of the radio button which gets selected and deselected immediately after that.. not cool.
    So my question is... is there something I am missing that could do the job without these workarounds... like a Changing event which I use for the ButtonBar but I can't find on the RadioButton or RadioButtonGroup... thanks!

    Hi,thanks for the reply. Actually that was my third option, but not sure if it's very good also..
    Here is a simple scenario:
    User must select between 2 radio buttons:
    1) no volume -> sets variable volume=0 and selects the radio button (that is the normal use case)
    2) set volume -> opens up a pop up with a list that has a X button to close and 4 options: 25% volume, 50% volume, 75%, 100%
    At this point the set volume radio button should not be selected and the user has 2 choices:
    -> hit the X button to close - nothing changes and no volume radio button is still selected and volume is still = 0
    -> hit one of the volume % buttons -> the set volume radio button gets selected and the variable volume=25/50/75/100 depending on the button selected by the user.
    That's a pretty common scenario and it's bugging me that I can't easily alter the radio button selection logic since whenever I click it, it gets selected and I can't put a logic in between in a standard way. This should apply to any component with selection, just like ButtonBar has it with the Changing event.
    So is there any other more convenient way to accomplish this scenario that you could recommend?
    Thanks!

  • How to associate a button with the selection/unselection of a JTable?

    hi,
    how to associate a button with JTable in this manna? i want to disable a button once there is no selection in the JTable, and enable the button when there is a selection. to associate the selection it is easy: just make an eventAction for the button on the click in the JTable and check whether there is a selection. but how to do this with the unselection? hope anyone can give me any hint. thanx!

    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame {
        String[] head = {"One","Two","Three"};
        String[][] data = {{"1-1","1-2","1-3"},{"2-1","2-2","2-3"},{"3-1","3-2","3-3"}};
        JTable jt = new JTable(data,head);
        public Test() {
         setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
         Container content = getContentPane();
         content.add(new JScrollPane(jt));
         jt.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
             public void valueChanged(ListSelectionEvent lse) {
              if (lse.getValueIsAdjusting()) return;
              if (jt.getSelectionModel().isSelectionEmpty()) {
                  System.out.println("Nothing Selected");
              } else {
                  System.out.println("Something Selected");
         setSize(500,500);
         show();
        public static void main( String args[] ) { new Test(); }
    }

  • How to check radio button as default on the basis of database value?

    Hi Friends,
    I have one jsp, in which I am having a field of radio button, which have two boolean values of 0 & 1. I want to check the radio button as default on the basis of database value, kindly help me out.
    Thanks a lot in advance. Please help me out.

    probably, when using struts you should do all your calculations in action class it self
    Eg. in jsp
    <html:radio name="myForm" property="myProperty" value="0">0</html:radio>
    <html:radio name="myForm" property="myProperty" value="1">1</html:radio>
    in Action class
    if (databaseValue == 0)myForm.setMyProperty(0);
    else if (databaseValue == 1)myForm.setMyProperty(1);
    rest will follow
    whatever be the value it will come selected

  • How to not display radio buttons in the select many shuttle component

    Hi all,
    af:selectManyShuttle is a true nice component.
    For business / UI ergo reasons I've decided to not display the radio buttons before each item. There's no option to do that.
    Is it possible ? How ?
    Regards
    Luc-

    Let say there are three ways:
    1. You can use skinning mechanism,
    2. You can include css file in .jspx page and then use it.
    3. You can write css directly in .jspx page.
    For skinning read documentation. For two other ways here is example code that should be inside metaContainer facet of document tag.
    <f:verbatim>
      <!-- CSS directly in jspx page -->
      <style type="text/css">
        .myClass{
          background-color: #8888FF;
      </style>
      <!-- Include css file in jspx page -->
      <link href="css/incStyle.css" rel="stylesheet" type="text/css" />
    </f:verbatim>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to check Radio buttons with Differfent button values

    Good Day,
    I am currently trying to write a script that would hide 5 of 6 radio buttons
    I have a radio button called "3. Transfer"
    with values of :
         Yes;
         Supp;
         Reg; and
         do_not_transfer
    as well I have a drop down called "REL.ITEM"
    with values of
              3(A);
              3(B);
              4(A);
              4(B); and
              4(C)
    I know how to get the value of the box and manipulate other fields
    like
    //START
    var transfer = getField("3. Transfer").value
    var relitem = getField("REL.ITEM").value
    if (transfer = "Yes" || transfer = "Supp") && (relitem == "4(C)" || relitem == "4(B)"))
         getField("a. recommend").checkThisBox(0,true);
         getField("a. recommend").display = display.visible
        getField("a. I do not recommend").checkThisBox(0,false);
        getField("a. I do not recommend").display = display.hidden
    else if (transfer = "do_not_transfer")
         getField("a. recommend").checkThisBox(0,false);
         getField("a. recommend").display = display.hidden
         getField("a. I do not recommend").checkThisBox(0,ftrue);
         getField("a. I do not recommend").display = display.visible
    //END
    I would like to make it so that if REL.ITEM != 4(A); 4(B); 4(C) that the radio box's with values of "Yes", "Supp" and "Reg" are hidden while "do_not_transfer" is still displayed and checked.
    I've been going through forums, google and acrobat documentation and I can't seem to find what I'm looking for.
    Thanks for your help in advance.

    if (transfer = "Yes" || transfer = "Supp") && (relitem == "4(C)" || relitem == "4(B)"))
    This should be:
    if ((transfer == "Yes" || transfer == "Supp") && (relitem == "4(C)" || relitem == "4(B)"))
    Similarly,
    else if (transfer = "do_not_transfer")
    should be:
    else if (transfer == "do_not_transfer")
    In order to work with an individual widgets of a form field, obtain an object that represents the widget using the getField method as specifically demonstrated in example #2 in the documentation: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.476.html

  • How to display Radio buttons?

    Hi all,
    I have a textfield say P18_No_OF_RADIOS.In this if the user enters 4 then immediately below the textfield four radio buttons needs to be displayed with editale textfields for radio buttons so that user could give values for each radio buttons.If 5 then 5 radio buttons...i.e with respect to the number radio buttons needs to be displayed!Is it possible?
    ~thanks

    Hi sweetcha,
    Check out following link
    http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_item.htm
    In this link check out function APEX_ITEM.TEXT and APEX_ITEM.RADIOGROUP
    Of course the task which you have mentioned is very much feasible using this utility. Let me know if you find some issue in it.
    Sunil Bhatia

  • How to Display key/text in default selection screen?

    HI Gururs,
    I want to display key/text in variable default selection screen in BI Analyzer in Quality.
    please give me any suggestions to resolve this.
    Thanks
    vadlamudi

    hi,
    What i have done is in the cube level, in the dimensions i have made specific properties and set to key/text in development, so its working fine in development of the analyzer, but still its showing text only in quality analyzer.
    please give me the solutions if you know any.
    regards
    vadlamudi

  • Displaying radio buttons with dynamic subforms between 2 radio buttons

    I am very new to Adobe Designer/Form Server and had the following question.
    Our form is going to have the following display
    Radio A
    Radio B
    Radio B1
    List of text boxes
    Radio B2
    Radio C
    Radio C1
    List of text boxes
    Radio C2
    When the form is first displayed, user sees Radio A, Radio B and Radio C, right below each other. When the user selects Radio B, Radio B1 and Radio B2 should appear, and the Radio C should 'slide' down to accomodate Radio B1 and B2.
    Similarly, when the user clicks Radio B1, List of text boxes should appear and Radio B2 should 'slide' down to accomodate those text boxes.
    Is this possible? Can anyone please send me a sample code/design?
    Thanks

    Well I got the form to work by copying the Options List Java Script code in change to docReady and adding if(this.rawValue==0).  This produces the result that I need.
    To clean this up I would like to put this code in a Script Object so I can use the same code in both change and docReady.  I’m not a programmer so I’m not sure what additional code I have to put in the Script Object and what code I have to put in change and docReady to use the Script Object.  Any assistance would be greatly appreciated.
    Thank you.

  • How to display a button with an icon?

    Hi,
    I'd like to display an SAP-icon on a button.
    In this thread How can I show an Icon in the tapStripItem-title?
    Thomas Jung gave the following example:
    > I don't know if this definetely works with tabstrips
    > items but it does work with buttons and toolbar
    > buttons.  What I do is create a BEE and render that
    > to a string. I then use that string as the text of
    > the element I want to place my image into:
    >
    >   <%
    >   data image type ref to cl_htmlb_image.
    >   data: image_string type string.
    >   create object image.
    >   image->id = `UserSelectionCancel2`.
    >   image->src = cl_bsp_mimes=>sap_icon( `ICON_CHECKED` D`).
    >   image->tooltip = ``.
    >   clear image_string.
    >   image_string = image->IF_BSP_BEE~RENDER_TO_STRING( G( page_context ).
    >   %>
    > <xhtmlb:toolbarButton id            = "UserSelectionCancel"
    > onClientClick = "closeiframe();"
    > enabled       = "<%= enabled %>"
    > text          = "<%= image_string %>" />
    I didn't find anything else about this topic and
    tried to adopt this for a button, but that doesn't work for me either.
    <htmlb:button id            = "byButt"
       text    = "<%= image_string %> ENTER"
       onClick = "myClickHandler"  />
    Is there a way/documentation to get this done?
    Thanks in advance.
    Cheers.
    -Alf

    > This technique is really just using a BEE, there is
    > documentation on the BEE concept in the online help
    > and Brian McKellar has a weblog on the subject as
    > well.
    OK, I think I get the idea. Will check the stuff. Thanks.
    > Notice the strange D at the end of the line. This
    > isn't in the original posting. Perhaps this is just
    > bad cut and paste.
    Just bad copy paste. Yes.
    > You say that this isn't working for you - but you
    > don't describe the results. Is there an error?  Does
    > it render anything in the button at all?  Does the
    > raw HTML get rendered?
    I just saw coding in the button.
    > You want to make sure that the
    > text doesn't get encoded - which would cause the HTML
    > source to display instead. On the htmlb:button you
    > will want to set the attribute encode = FALSE.
    OK, that was right on spot. This shows me the Icon! Strike!
    > Also I am not sure that you can also pass in text
    > with the image like that.  You might have to create a
    > full BEE and add the image and a textView separately
    > into the BEE.  Then render the entire BEE to a string.
    I'll check the documentation on BEE and give it a try.
    Thanks for your answer.
    Thats a starting point for me.
    Alf

  • How to create radio button between two slection screen

    hello all.
    could you please guide me how to create radio button between two SELECTION-SCREEN  in screen painter.
    Thank you,
    srinivas

    hi
    SEE THIS CODE
    REPORT  ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).
    ******DATA DECLARATIONS**********
    DATA : BEGIN OF IT_PLANT OCCURS 0,
            MATNR LIKE MARA-MATNR,
            WERKS LIKE MARC-WERKS,
            PSTAT LIKE MARC-PSTAT,
            EKGRP LIKE MARC-EKGRP,
           END OF IT_PLANT.
    DATA : BEGIN OF IT_PONO OCCURS 0,
            EBELN LIKE EKKO-EBELN,
            EBELP LIKE EKPO-EBELP,
            MATNR LIKE EKPO-MATNR,
            WERKS LIKE EKPO-WERKS,
            LGORT LIKE EKPO-LGORT,
           END OF IT_PONO.
    TABLES EKKO.
    ********END OF DATA DECLARATIONS*********
    ********SELECTION SCREEN DESIGN ***********
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R3 RADIOBUTTON GROUP G2 DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R3.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R4 RADIOBUTTON GROUP G2.
    SELECTION-SCREEN COMMENT 5(20) TEXT-004 FOR FIELD R4.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    ******END OF SELECTION SCREEN DESIGN****************
    <b>rEWARD IF USEFULL</b>

  • How to differentiate between Radio Buttons with the same name?

    My form has two fields, to which I gave the same name ("Radio Button 1.0") in order to achieve mutual exclusivity.
    Now, I would like to use JavaScript to retrieve the value of one the two fields:
    var checkMark = this.getField("Radio Button1.0");
    if (checkMark.value == "Yes") {
    Questions:
    What is the proper way to inspect the value of a Radio Button? I have tried this:
    if (checkMark.value == "No") [...]
    but it doesn't seem to work.
    How can I tell apart 2 radio buttons with the same name?
    TIA,
    -RFH

    When Radio Buttons and Check Boxes are unchecked their value is "Off", so if you have "Yes", "No" buttons you will also encounter an 'Off" value. Now if you want to look at a given button, you will have to use the "isBoxChecked(nWidget)" method.
    nWidget:
    The 0-based index of an individual radiobutton or checkbox widget for this field. The index is determined by the order in which the individual widgets of this field were created (and is unaffected by tab-order).
    Every entry in the Fields panel has a suffix giving this index, for example MyField #0.
    Returns
    true if the specified widget is currently checked, false otherwise.
    Example
    var f = this.getField("ChkBox");
    if(f.isBoxChecked(0))
    app.alert("The Box is Checked");
    else
    app.alert("The Box is not Checked");

  • How can i declare a single radio button field in selection-screen ?

    How can i declare a single radio button field in selection-screen ?

    >
    Rob Burbank wrote:
    > And how will you turn it off once it is turned on??
    >
    > Rob
    Thats correct ;)...See ravi if users will ask so many things its our Job to convay the correct solution ....
    Just post your org requirement..SOo some body guide you better//
    Sas

  • While opening a screen none of the radio button should not selected

    Hi,
    i have three radio button on the screens.By default the first radio button is getting selected for each and every time when ever i'm opening the screen.i dont want the default select should happen and even i dont want any of the radio button should be selected.
    how i can acheive through dialog programming.
    kind regards,
    Poornima.

    Hi,
    You can have radio buttons with any one field selected from a group .
    ex:
    selection-screen begin of block b2 with frame title text-042.
    parameters:r_detail    radiobutton  group g2 user-command cmd default
    'X',
           r_sumry   radiobutton  group g2,
           r_totals    radiobutton group g2.
    selection-screen end of block b2.
    or
    selection-screen begin of block b2 with frame title text-042.
    parameters:r_detail    radiobutton  group g2 user-command cmd,
           r_sumry   radiobutton  group g2 default 'X',
          r_totals    radiobutton group g2.
    selection-screen end of block b2.
    or
    selection-screen begin of block b2 with frame title text-042.
    parameters:r_detail    radiobutton  group g2 user-command cmd,
           r_sumry   radiobutton  group g2 ,
          r_totals    radiobutton group g2 default 'X'.
    selection-screen end of block b2.
    Else you can opt for checkbox and have all of them not checked.
    Regards,
    Dep

  • Radio Button with Submit Ready Only problem

    Hello,
    My radio button with submit ready only condition doesn't work correctly. When I click the a link on the first page
    it brings me to an update page. I have a radio button with submit, that won't open as a read only.
    It is being populated by SQL query, with the Null option selected. When I open the page I don't want the user to be able to edit the field unless they delete records associated with the field. Pretty much I want it to be disabled if the user has a record associated with it.
    Here are the queries.
    Source:
    SELECT OPLAN_IMPACTED_I
    FROM DFCY
    WHERE DFCY_SEQNO = :P12_DFCY_SEQNO
    Read only condition:
    SQL Exists query
    SELECT o.dfcy_seqno
    FROM oplan_impactd o, dfcy d
    WHERE o.dfcy_seqno = :p12_dfcy_seqno
    and :P12_OPLAN_IMPACTED_I = d.OPLAN_IMPACTED_I
    and :P12_OPLAN_IMPACTED_I = 'Yes'
    So when the page renders it's like you can change oplan, how do I make it read only when the page renders?
    Thanks,
    Mary

    Hi,
    If that is the source of the radiogroup, then it should be:
    SELECT OPLAN_IMPACTED_I d, OPLAN_IMPACTED_I r
    FROM DFCY
    WHERE DFCY_SEQNO = :P12_DFCY_SEQNOThis should return two values for each radio button - the displayed text and the returned value. If your radios do not have a returned value, then "Yes" will never be found. You can check this by loading the page and doing a View Source on it - search for RADIO and check what "value" attributes they have.
    Andy

Maybe you are looking for

  • My sequence is no longer showing up in the time line!

    Hey, So I'm working on a DVD video for my nan's funeral and I opened the project and my edited sequence is no longer in the time line! I click on it but nothing shows up. It's as if I haven't done any editing in it yet. But I have and I have saved it

  • Payorders

    Hi, I have a issue with relating to generating payment order during the payment run. when the payment order is generated during the payment run instead of the payment how can i run the payment order in later date to update by books?(please let me kno

  • Applet Rendezvous port error

    When I try to execute a client/server applet , unable to connect to the server (server is external, not in my subnet). Client applet throws the following error, Error message: Server port: 30000 MPStudent.ERROR: Can't open socket on rendezvous port 3

  • 1142 errors out while downloading image

    I have a 4402 controller just recently upgraded to code 5.2.178. I have a new 1142 out of the box and I am trying to get it up and running. It finds the controller and starts the image download but then stops with the following error: capwap_image_pr

  • Does any one know what IP means

    I kneed to know what Ip means or how to get it so I can email back Itunes for support testing thanks fordlover