Setting/Clearing Dynamic Radio Button values

Hi, i have the following Radio buttons defined within an iteration
<c:forEach items="${searchresults}" var="post" varStatus="status">                                        
     <tr class = "text_results"> 
          <c:url value="/searchposts.do" var="url">
               <c:param name="postitle" value="${post.postId.postTitle.title}"/>
               <c:param name="postcode" value="${post.postId.postTitle.code}"/>                    
               <c:param name="unitcode" value="${post.postId.units.unitCode}"/>
               <c:param name="auth" value="${post.postId.auth}"/>
          </c:url>
          <td>
               <a href='<c:out value = "${url}" />'>                                        
               <c:out value="${post.postId.postTitle.title}"></c:out></a>
          </td>
          <td><c:out value = "${post.mustering}"/></td>  
          <td><c:out value = "${post.rank}"/></td>  
          <td>
               <html:radio property="incmbt" 
                    value='${post.postId.postTitle.title}'>
               </html:radio>                                             
               <a href = "javascript:unCheckRadio(document.searchForm.incmbt)">
                    clear
               </a>
          </td>                                             
     </tr> 
</c:forEach>  The property "incmbt" is declared as a form property (String incmbt) with its getters and setters ... i plan to set each radio button with a value from database within an object called post. The actual value to set for each radio is a post title ... I seem to be getting a NULL value when i try to get the value in action class (form.getIncmbt() yields null) ... Am i assigning the value correctly?
Further, here's is how i clear the values which seems to work
Javascript
function unCheckRadio(btngrp) {     
     for(var i=0; i < btngrp.length; i++)
          if( btngrp.checked == true ) {
               btngrp[i].checked = false;
               document.write("Selected Radio is :" + btngrp[i].value);
But the "Selected Radio is :" displays "${post.postId.postTitle.title}", not the actual post title... ???

I just thought about this quickly, i think its because an href link does not submit form values ... If so, how can i submit the value of a radio button through the <c:param/> tag or any other way after clicking the href link to submit the form?

Similar Messages

  • To Retrieve dynamic radio button values using jsp & javascript

    Hi All,
    How can i retrive the dynamically created radio button values and also want to get the clicked radio button values.I am using JSP and JAVA beans to retrive the values from the form. I dont have any probs to retrieve combo box values, text box values only problem showing with radio button values. If any data which is entered wrong in the form all the fields should prefills with the old value.Except radio button values all others fields such as combo box, text box values are prefilled with the old values.
    I have given the code for radios.
    document.write('<input type="radio" name="distradio" OnClick="sampleReq.fcidis.value=\'Y\'"/>Yes   ');
    document.write('<input type="radio" name="distradio" OnClick="sampleReq.fcidis.value=\'N\'"/>No');
    document.write('<input type="hidden" name="fcidis" value="">')
    <form method="POST" action="Update.jsp" name="sampleReq" >
    <tr>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='supplier'"/> supplier
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='customer'"/>customer
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='distributor'"/> distributor
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='employee'"/> employee
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='New partner'"/>New partner
    <input type="hidden" name="requester1" value=""/>
    </td>
    </tr>
    Advanced Thanks for help
    Regards
    Sona

    Hi,
    If you have this code
    document.write('<input type="radio" name="distradio" OnClick="sampleReq.fcidis.value=\'Y\'"/>Yes ');
    document.write('<input type="radio" name="distradio" OnClick="sampleReq.fcidis.value=\'N\'"/>No');
    document.write('<input type="hidden" name="fcidis" value="">')
    <form method="POST" action="Update.jsp" name="sampleReq" >
    <tr>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='supplier'"/> supplier
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='customer'"/>customer
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='distributor'"/> distributor
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='employee'"/> employee
    </td>
    <td class="Txt_gris">
    <input type="radio" name="requester" OnClick="sampleReq.requester1.value='New partner'"/>New partner
    <input type="hidden" name="requester1" value=""/>
    </td>
    </tr>
    this field distradio will not be able Update.jsp.
    You will need to insert these field into the form definition.
    Now, to get a valeu from a radio button, you need only to do request.getAttribute("fieldName").
    To generate dinamically all radio button values, i need to know where are these information? In database? If yes, you need to read the resultset na in value attribute you need to do somethink like this <input type=radio name=fieldName value="<%out.println(resultset.getString("FieldName"));%>">
    If you have more question, only send me a email,
    best regards
    Edney Imme
    [email protected]

  • Passing radio button values to the backing bean

    Hi all,
    I need help with passing group of radio button values to a backing bean. I have page which has a dataTable to display a list of alerts. For each alert there are two radio buttons (YES & No) to indicate whether the email option for each alert is set or not. Now when i change the radio buttons and click on a submit button i should be able to pass these radio button values into action method in which i need to update the alerts. This is my code
    <h:form>
    <t:dataTable id="sub"
                       var = "alert"
                       value =#{subscriberBean.alertsList}">
    <t:column>
    <h:outputText value="#{alert.name}" />
    </t:column>
    <t:column>
    <h:selectOneRadio id="subscriptions" value="#{alert.sendEmail}">
      <f:selectItem id="item1" itemLabel="Yes" itemValue="0" />
      <f:selectItem id="item2" itemLabel="No" itemValue="1" />
    </h:selectOneRadio>
    </t:column>
    <t:dataTable>
    <h:commandButton id="button1" value="Save changes" actionListener="#{subscriberBean.updateAlert}" />
    </h:form>
    {code}
    I tried to to do something like below and get the updated list in the action event in the backing bean but it didn't work.
    {code}
    <h:commandButton id="button1" value="Save changes" actionListener="#{subscriberBean.updateAlert}" >
    <f:attribute name="alerts" value="#{subscriberBean.alertsList}"/>
    </h:commandButton>
    // Backing Bean
    public void updateAlert(ActionEvent e){
    List<Alert updateList = (List<Alert>)event.getComponent().
                    getAttributes().get("alerts");
    {code}
    Can someone advise how to get these update radio button values in my actionListener method.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The value the user selected will be written to the sendEmail property of the managed bean named alert. We know this because you set the value attribute to #{alert.sendEmail}. So simply access the managed bean in your action method.

  • 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.

  • Dynamic radio button population

    Hi There
    I have the following logic to be implemented
    1) show two radio buttons A and B
    2) if user selectes A then ok do noting
    but if user selects B then
    display another set of radio buttons (6 radio buttons)
    Please let me know how to get the value of the radio button (A or B) before the form gets submitted
    I thought i will use custom tags if possible but not able to do that
    or if there is any other approach please help.

    Hi BasulC,
    Thanks for your quick reply.
    Actually I can do it using DOM but i need to use preexisting costom tags while creating the radio buttons and custom tags cannot be used in javascripts hence i am not able to do it in javascript
    is there no way to get the selected radio button value in the custom tag handler
    kind regards
    Proffy

  • 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

  • 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.

  • How to give the radio button value dml statement

    Oracle Forms6i
    Hai All
    I have created a form I the form i have created two radio button and named as appr, Recmd when i execute the forms appr is marked by default
    So now i need to insert or update this radio button value in my Table
    how can i insert or update this radio button value
    pls tell me the steps to do
    Thanks In Advance
    Srikkanth.M

    Hi,
    :<your_radiogroup_name> will give the selected radiobutton value

  • Setting a Radio Button value using Javascript

    After much research, I've figured out that the appropriate command to get the value of a Radio Button in APEX JavaScript is "html_RadioValue", but I haven't been able to figure out a command that will let you set the value of the Radio Button. Is there documentation on APEX's use of JavaScript that covers this issue?
    Here's a simplified version of the script:
    <script language="JavaScript" type="text/javascript">
    function showval()
    var item1 = html_RadioValue('P19_RADIO');
    alert(item1);
    //Reverse the current selection
    if (item1 == 'Y') then
    <mystery_statement> //set P19_RADIO to N.
    else
    <mystery_statement> //set P19_RADIO to Y.
    </script>
    I've tried the following, but none of them have worked:
    - document.getElementById("P19_RADIO").value = 'N';
    - document.getElementById("P19_RADIO").checked = 'N';
    - $x('P19_RADIO').value = 'N';
    - $x('P19_RADIO').checked = 'N';
    Thanks.

    Okay, that worked in the Oracle-hosted environment, but not in my development environment. Looking at the view/source output from each, it seems that the versions of APEX are different - my environment is using version 3.0.1.00.07.
    The most obvious difference between the sources is the javascript includes at the top:
    <script src="/i/javascript/apex_ns_3_1.js" type="text/javascript"></script>
    <script src="/i/javascript/apex_3_1.js" type="text/javascript"></script>
    <script src="/i/javascript/apex_get_3_1.js" type="text/javascript"></script>
    <script src="/i/javascript/apex_builder.js" type="text/javascript"></script>
    vs.
    <script src="/i301/javascript/htmldb_html_elements.js" type="text/javascript"></script>
    <script src="/i301/javascript/htmldb_get.js" type="text/javascript"></script>
    My fundamental question is: how does one learn Javascript, in the context of APEX? I can't find any documentation that explains what $v means, or what $x means, or what $s means.
    Thanks.

  • When saving form with 'Save As', losing radio button value

    I recently upgraded from Acrobat Pro 8.2 to Acrobat Pro 10.  Now experiencing the following issue:
    I have a PDF form, that is filled by an application.   With Acrobat Pro 10, if I open the completed form, and then use 'File' > 'Save As' > 'PDF', then the radio button fields lose their value.  Other fields retain their value, only the radio button fields become blank.   If I use the 'Save' option, then the radio buttons do not lose their value.
    Any help is appreciated!

    Hi,
    Can you check on your page to see if you have "reset page" process - if so, you could probably remove it. Also check on your page branches so see if you are clearing the cache for the page. If your page item is not related to a table field, you can also change the "Source Used" setting for it to "Only when current value in session state is null".
    When you submit a page, all page items should be stored in the session and would be available the next time the page is reloaded UNLESS you clear the cache for the page or the Source settings instruct Apex to retrieve the value from elsewhere - the above are the most likely causes, so check them first
    Andy

  • 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

  • Dynamic radio buttons - Saving state?

    Hello
    I am trying to add some radio button groups to a page displaying products for sale. The number of groups depends on the record being displayed. For example, a television might have two option groups, one named 'Size' with options 24", 26", 28", another named 'Colour' with options black and silver.
    I have a DataTable bound to a HtmlDataTable in a backing bean This has an ArrayDataModel as its value. The DataTable has two columns. The first one displays the attributes name, e.g. 'Colour'. The second column displays the attributes values as a radio button group.
    When the product is loaded, the ArrayDataModel ('attributesArray') in the backing bean is populated with the product attributes. The class of objects held in the array are Object[] as this is necessary to split the data for the two columns.
    E.g. for two attribute in the table 'Size' and 'Colour'
    Object[] attributesArray = new Object[2];
    ArrayList colourSelectItems = new Array();
    ArrayList sizeSelectItems = new Array();
    SelectItem 24inch = new SelectItem(new Integer(24),"24 inch");
    SelectItem 26inch = new SelectItem(new Integer(26),"26 inch");
    SelectItem 28inch = new SelectItem(new Integer(28),"28 inch");
    SelectItem black = new SelectItem("silver","Silver");
    SelectItem silver = new SelectItem("black","Black");
    colourSelectItems.add(black);
    colourSelectItems.add(silver);
    sizeSelectItems.add(24inch);
    sizeSelectItems.add(26inch);
    sizeSelectItems.add(28inch);
    Object colourAttributeArray = new Object[]{"Colour",colourSelectItems};
    Object sizeAttributeArray = new Object[]{"Size",sizeSelectItems};
    attributesArray[0] = colourAttributeArray;
    attributesArray[1] = sizeAttributeArray;On the page i display the datatable as follows:
    <h:dataTable id="attributesTable" binding="#{addProductBean.attributesTable}" var="attribute" cellspacing="0" cellpadding="0" border="0" width="100%" columnClasses="default">
      <h:column id="attributeNameColumn">
        <h:outputText id="attributeName" value="#{attribute[0]}:" style="margin-right: 4px;"/>
      </h:column>
      <h:column id="attributeValuesColumn">
        <h:selectOneRadio id="attributeValues">
          <f:selectItems value="#{attribute[1]}"/>
        </h:selectOneRadio>
      </h:column>
    </h:dataTable>This works fine except I would like the first radio button in each group selected by default.
    This can be done pretty easy.
    I just change the row array to hold an extra element with the id of the default select item in it and add a value parameter to the h:selectOneRadio tag
    Object colourAttributeArray = new Object[]{"Colour","silver",colourSelectItems};
    Object sizeAttributeArray = new Object[]{"Size","24inch",sizeSelectItems};
    <h:selectOneRadio id="attributeValues" value="#{attribute[1]}">
      <f:selectItems value="#{attribute[2]}"/>
    </h:selectOneRadio>But there is a problem...
    Since the number of rows is dynamic there could be any number of radio button groups. As there is only one h:selectRadioButton in the display code (within the datatable tag) it can't be bound to a HtmlSelectOneRadioButton object in the backing bean. Each group loses its value if the form is submitted and returned with errors on it.
    Any solution or other help greatly appreciated. Thanks.

    I believe in this case, the standard way of doing things would be best. Create two String variables and a respective getter and setter. One String will hold the selected size, the other will hold the selected colour. Bind the value attribute of each selectOneRadio to the respective getter/setter of the backing bean.
    If you want to set the default to "silver" or "24inch", just initialize the String with those values.
    Here's how you're code will break down:
    Object[] attributesArray = new Object[2];
    ArrayList colourSelectItems = new Array();
    ArrayList sizeSelectItems = new Array();
    SelectItem 24inch = new SelectItem(new Integer(24),"24 inch");
    SelectItem 26inch = new SelectItem(new Integer(26),"26 inch");
    SelectItem 28inch = new SelectItem(new Integer(28),"28 inch");
    SelectItem black = new SelectItem("silver","Silver");
    SelectItem silver = new SelectItem("black","Black");
    colourSelectItems.add(black);
    colourSelectItems.add(silver);
    sizeSelectItems.add(24inch);
    sizeSelectItems.add(26inch);
    sizeSelectItems.add(28inch);
    Object colourAttributeArray = new Object[]{"Colour",colourSelectItems};
    Object sizeAttributeArray = new Object[]{"Size",sizeSelectItems};
    attributesArray[0] = colourAttributeArray;
    attributesArray[1] = sizeAttributeArray;
    String selectedColour = "silver";
    String selectedSize = "24inch";Don't forget to create your getter and setter for selectedColour and selectedSize in the addProductBean.
    And then create your datatable the same, but change the selectOneRadio tag like this:
    <h:selectOneRadio id="attributeValues" value="#{addProductBean.selectedColour}">
      <f:selectItems value="#{attribute[1]}"/>
    </h:selectOneRadio>Does that make any sense? Let me know how it turns out.
    CowKing
    PS - BTW, when you set the SelectItems for the TV size, you use Integer's as the value. Then later in your examples, you set the defaults using a String. Is this just a typo? I assume that you can get it working fine in whatever way you need it.

  • Dynamic Radio Buttons

    am BRAND SPANKING NEW to java and I have a site (created by someone else obviously) which shows 2 text boxes dynamically depending on a number that is entered into the "NumAdults" box. So if you enter "2", you get:
    age.text box, tripcost.text box, age.text box, tripcost.text box
    What I'm trying to do, is add a radio button to the mix. For example, if you entered "2", I want it to show
    age.text box, tripcost.text box, member.radio button, age.text box, tripcost.text box, member.radio button.
    The code for the text boxes is working fine but the radio buttons won't work! The radio buttons are elements named rbmember1 through rbmember10. The code - (I've tried to add the radio buttons - please don't laugh) so far is as follows: - Please, can anyone see what I'm doing wrong here?
    txtNumAdults.Value = pol.Insureds.Count.ToString();
    hdnSelectedPlan.Value = pol.Pol.PlanCode;
    for(int i=0;i<pol.Insureds.Count;i++)
    TextBox txt = FindControl("txtAdultAge"+(i+1).ToString()) as TextBox;
    txt.Visible = true;
    txt.Text = pol.Insureds.Age.ToString();
    txt = FindControl("txtTripCost"+(i+1).ToString()) as TextBox;
    txt.Visible = true;
    txt.Text = pol.Insureds[i].TripCost.ToString("n");
    Radiobutton rb = FindControl("rbMember"+(i+1)) as RadioButton;
    rb.Visible = true;

    Well, it kind of looks like javascript to me.. (I didn't realize there was a difference!. . that's how new I am)

  • Pre-populating forms with radio button values

    I have been pulling my hair out trying to figure out why my action page is not being pre-populate with the value that is passed from the radio button selection. Can get my hands around what I am actually doing wrong. I have changed my code several times and can not keep up with any more. So below, I have included the main page and the action page that needs to be pre-populated with the data from the database. Thank you in advance for you help and time.
    MAIN.cfm
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <!--- Declare and initialize the variables
    --->
    <cfset today = DateFormat(Now(),"mmmm d, yyyy")>
    <cfset current_time = TimeFormat(Now(),"h:mm tt")>
    <cfset application_name = "Corporate Intranet Directory">
             <cfset current_url ='http://'& #CGI.SERVER_NAME# & ':'& #CGI.SERVER_PORT# & #CGI.SCRIPT_NAME#>
    <cfset current_browser = #CGI.HTTP_USER_AGENT#>
    <html>
    <head>
    <title>Employee Directory</title>
    </head>
    <!--- Included heading for the page--->   
    <h1>Employee Directory</h1>
    <body>
    <!--- Display the today date and the current time--->
    <cfoutput>Today's date is #today#</cfoutput><br>
    <cfoutput>The current time is #current_time#</cfoutput><p>
    <!---Display the URL and Browser used for the template --->
    <p><cfoutput>URL of this template: #current_url#</cfoutput>
    <cfoutput>Browser used: #current_browser#</cfoutput></p>
    <!---Insert a field to have the user search by email address --->
    <tr bgcolor = "yellow">
    <td>Search</td>
    </tr><br>
    Email: <input type="text" name="EmailAddress"
    size="20" maxlength="100"><br>
    <input type="Submit" value="Search"><p>
    <!--- Query the Employees table to find the employee who's ManOfTheYear is set to "YES"--->  
    <cfquery name="employeeOfTheMonth" datasource="Directory">
        select
                e.FirstName,
                    e.LastName
                from
                Employees e
                where
                e.ManOfTheMonth = 'Yes'
            </cfquery>             
    <!--- Query the Employees and Departments tables to find employee's First Name, Last Name, Title, Phone Extension, Email Address, and Department Name--->      
    <cfquery name="employees" datasource="Directory">
    select
    e.EmployeeID,
    e.FirstName,
    e.LastName,
    e.Title,
                    e.PhoneExtension,
                    e.EmailAddress,
                    d.DepartmentName,
    d.DepartmentID
    from
    Employees e,
                    Departments d
                where
                e.DepartmentID = d.DepartmentID
    </cfquery>
    <table border="2" bordercolor="blue">
    <!--- Display the Employee of the Month--->   
              <cfoutput query="employeeOfTheMonth">
    <tr>
                <th align="center" colspan="5">Employee of the Month: #employeeOfTheMonth.FirstName# #employeeOfTheMonth.LastName# </th>
                </tr>
                </cfoutput>
                <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Title</th>
    <th>Department</th>
    <th>Phone Extension</th>
                    <th>Email</th>
    </tr>
    <!--- Display the First Name, Last Name, Title, Department Name, Phone Extension, and Email Address--->   
    <form action="admin3.cfm?EmployeeID=#EmployeeID#" method="post">
    <cfoutput query="employees">
    <cfswitch expression="#DepartmentID#">
        <cfcase value="1">
           <cfset backgroundcolor="00FFFF">
       </cfcase>
    <cfcase value="2">
           <cfset backgroundcolor="ff6699">
       </cfcase>
    <cfcase value="3">
           <cfset backgroundcolor="99ff99">
       </cfcase>
    <cfcase value="4">
           <cfset backgroundcolor="ffcc99">
       </cfcase>
    <cfcase value="5">
           <cfset backgroundcolor="cc99ff">
       </cfcase>
        <cfdefaultcase>
            <cfset backgroundcolor="red">
        </cfdefaultcase>
    </cfswitch>
    <tr bgcolor=#backgroundcolor#>
    <td><input type ="radio" name="EmployeeID" value="#employees.EmployeeID#"</td>
    <td><a href="http://localhost:8500/spiderbytes/assignments/employee_details.cfm?EmployeeID=#EmployeeID#"> #employees.FirstName# #employees.LastName#</td>
    <td>#employees.Title#</td>
                    <td>#employees.DepartmentName#</td>
    <td>#employees.PhoneExtension#</td>
                        <td>#employees.EmailAddress#</td>
    </tr>
    </cfoutput>
    <tr>
    <!--- Display the number of employee's in the directory--->
    <td align="right" colspan="5"><cfoutput>#employees.recordCount# Employee(s) found.</cfoutput></td>
    </tr>
    </table>
    <input type="Submit" name="Action" value="Add New Employee">
    <input type="Submit" name="Action" value="Edit Employee">
    <input type="Submit" name="Action" value="Delete Employee"><p>
    </form>
    <!--- Include a footer --->
    <CFINCLUDE template="footer.cfm">
    </body>
    </html>
    ADMIN.cfm
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Add New Employee</title>
    </head>
    <body>
    <CFIF ISDEFINED("Action")>
    <!--- Use the "Action" variable to display the same name as a heading --->
    <h1><CFOUTPUT>#Action#</CFOUTPUT></h1>
    <!--- Determine if the user select Edit Employee or Delete Employee --->
    <CFIF Action IS "Edit Employee" OR Action IS "Delete Employee">
    <!--- Query the database to get the data for current employee the user
    selected--->
    <cfquery name="DisplayEmployeeRecord" datasource="Directory">
    SELECT *
    FROM Employees
    Where EmployeeID = #EmployeeID#
    </cfquery>
    <cfoutput query="DisplayEmployeeRecord">
    <cfset variable.EmployeeID = "#EmployeeID#">
    <cfset variable.FirstName = "#FirstName#">
    <cfset variable.LastName = "#LastName#">
    <cfset variable.DepartmentID = "#DepartmentID#">
    <cfset variable.Title = "#Title#">
    <cfset variable.Salary = "#Salary#">
    <cfset variable.PhoneExtension = "#PhoneExtension#">
    <cfset variable.HomeAddress = "#HomeAddress#">
    </cfoutput>
    </CFIF>
    <form action="query.cfm" method="post">
    <table border="2">
    <!--- Server-Side Validation - First Name, Last Name, Department, and and Email Address are required
    fields --->
    <input type="hidden" name="EmployeeID_required" value="First Name is
    a required field">
    <input type="hidden" name="FirstName_required" value="First Name is
    a required field">
    <input type="hidden" name="LastName_required" value="Last Name is
    a required field">
    <input type="hidden" name="DepartmentID_required" value=" Department ID is
    a required field - Please fill in the coorsponding Department ID for the employee">
    <input type="hidden" name="EmailAddress_required" value="Email Address is
    a required field">
    <!--- Create a table for the names of the fields and the textbox --->
    <tr>
    <td>
    First Name (required): </td>
    <td><input type="Text"
    name="FirstName" size="35" maxlength="35"><br></td>
    </tr>
    <tr>
    <td>
    Last Name (required): </td>
    <td><input type="Text" name="LastName"
    size="35" maxlength="35"><br></td>
    </tr>
    <tr>
    <td>
    Department Number (required): </td>
    <td><input type="Text"
    name="DepartmentID" size="35" maxlength="4"><br></td>
    </tr>
    <tr>
    <td>
    Title: </td>
    <td><input type="Text"
    name="Title" size="35" maxlength="35"><br></td>
    </tr>
    <tr>
    <td>
    Salary: </td>
    <td><input type="Text" name="Salary"
    size="35" maxlength="10"><br></td>
    </tr>
    <tr>
    <td>
    Email (required): </td>
    <td><input type="Text" name="EmailAddress"
    size="35" maxlength="35"><br></td>
    </tr>
    <tr>
    <td>
    Work Phone: </td>
    <td><input type="Text" name="PhoneExtension"
    size="35" maxlength="10"><br></td>
    </tr>
    <tr>
    <td>
    Address: </td>
    <td><input type="Text" name="HomeAddress"
    size="35" maxlength="50"><br></td>
    </tr>
    <!--- Adds the new employee to the Directory database---> 
    <tr>
    <th align "center" colspan ="2">
    <br><input type="Submit" name="Action" value="<cfoutput>#Action#</cfoutput>">
    </th>
    </tr>
    </table>
    </form>
    <!--- Include a footer --->
    <CFINCLUDE template="footer.cfm">
    </body>
    </html>
    </CFIF>

    Thanks for your reply.  The radio button was placed inside the anchor so that when the user selects that employee, it will pre-populate the from base upon the "Action" selected (i.e. Edit Employee and Delete Employee).  I quite sure this can be done with out using javascript.  I know that I accomplish this by using a drop-down list, but I would like to use the radio buttons instead because I would have to change my code.
    Here is the  code with the radio button:
    <tr bgcolor=#backgroundcolor#>
    <td><input type ="radio" name="EmployeeID" value="#employees.EmployeeID#"</td>
    <td><a href="http://localhost:8500/spiderbytes/assignments/employee_details.cfm?EmployeeID=#EmployeeID#"> #employees.FirstName# #employees.LastName#</td>
    <td>#employees.Title#</td>
                    <td>#employees.DepartmentName#</td>
    <td>#employees.PhoneExtension#</td>
                        <td>#employees.EmailAddress#</td>
    </tr>
    Here is are some ways that I coded my form action is coded:
    <form action="admin3.cfm" method="post">  OR
    <form action="admin3.cfm?EmployeeID =# EmployeeID#" method="post">

  • 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

Maybe you are looking for

  • How do I change the order of phone numbers in a contact?

    When I enter phone numbers for a contact on the iPhone, they seem to be stuck in the order they were entered. Is there any way to change the order using the phone interface? I sync with Yahoo Address Book. Will the order be preserved if I change the

  • Workflow task in "In Process"

    Hi all, I have a workflow task that stayed in the "In Process" state.  The task's method calls a function.  I don't know if the function had an error or what actually happened.  The function makes a call to a third party software(PRISM).  I have the

  • Problem in displaying customized flex window.

    0 Hi I've created a customized settings sub-window, with an AIR application and facing a problem in displaying it more than one time from the application, i.e for the first time i select option from context menu then the settings window is displayed

  • Help with conditional styling

    Hi all, I have a dynamic report and I want to right align a column when it contains a number. I tried using a column template with a pl/sql expression but it simply doesn't work. Anybody knows how to ? thanks Mauro

  • How can i recover deleted yahoo email? its also deleted in trash?

    how can i recover deleted yahoo email? its also deleted in trash?