Results 1 to 2 of 2
  1. #1
    vivekbakshi is offline Member
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0

    Question How to use "selectOneRadio" to enable/disable a Picklist

    Hi,

    I m having a requirement to enable/disable two picklists using "<h:selectOneRadio>".
    Kindly reply if anyone has done similar thing before or if any one can provide any suggestions on how to acheive this?

    Thanks in Advance!
    Vivek

  2. #2
    vivekbakshi is offline Member
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0

    Wink

    Finally,

    I found a way to get this done... I managed to get this work using JavaScript. Look for the code below.

    <script type="text/javascript">

    function enablePickList(form,radio,picklist1,picklist2)
    {
    var radio = document.formsformform+\":\"+radio[0].checked;
    if(radio)
    {
    document.getElementById(form+":"+picklist1).disabl ed = false;
    document.getElementById(form+":"+picklist2).disabl ed = true;
    }
    else
    if(!radio)
    {
    document.getElementById(form+":"+picklist1).disabl ed = true;
    document.getElementById(form+":"+picklist2).disabl ed = false;
    }
    }
    </script>

    <h:selectOneRadio id="myRadio1"
    value="#{GLAccountDimension.enablePicklist}" onclick="enablePickList ('glaccountinsert','myRadio1','AccountLevelList1', 'AccountLevelList2');">

    <j:selectItem itemValue="true" itemLabel="Select">
    <h:selectOneMenu id="AccountLevelList1"
    value="#{GLAccountDimension.glAccountLevel1}"
    immediate="true" disabled="true">
    <j:selectItems value="#{GLAccountDimension.glAccountLevel1List}" />
    </h:selectOneMenu>
    </j:selectItem>

    <j:selectItem itemValue="false" itemLabel="Select">
    <h:selectOneMenu id="AccountLevelList2"
    value="#{GLAccountDimension.glAccountLevel2}"
    immediate="true" disabled="true">
    <j:selectItems value="#{GLAccountDimension.glAccountLevel2List}" />
    </h:selectOneMenu>
    </j:selectItem>
    </h:selectOneRadio>

Similar Threads

  1. Hwlp with "Open", "Save", "Save as..."
    By trill in forum New To Java
    Replies: 3
    Last Post: 11-02-2010, 10:26 AM
  2. Replies: 1
    Last Post: 03-14-2008, 03:51 PM
  3. Replies: 1
    Last Post: 07-27-2007, 11:59 PM
  4. Replies: 1
    Last Post: 07-25-2007, 11:55 PM
  5. Replies: 1
    Last Post: 07-16-2007, 07:32 AM

Posting Permissions

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