How to get selected value from SelectOneChoice

Hi,
I'm facing a problem to get selected value from SelectOneChoice. I have valueChangeListener event on a (SelectOneChoice)item. After user makes a choice I want to store selected value in a bean property to pass it to a method.
For example List item shows dname from dept table after user makes a choice I want to get deptno and populate into bean which I use to pass into my method.
If I use valueChangeEvent.getNewValue() I always get negative value instead I want deptno selected. Sample code pasted below.
public void setDeptno(ValueChangeEvent valueChangeEvent) {
BindingContainer b = getBindings();
OperationBinding oB = b.getOperationBinding("setDeptno");
//Checking instance of because same method is called from another text inputText item.
if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
if (columnName.getId().toString().equals("deptDname")){
JSFUtils.setManagedBeanValue("dept.deptDeptno",valueChangeEvent.getNewValue());
}

if your selectOneChoice has value equal to #{bindings.deptno} bound to the iterator Dept1Iterator,
then the backing code will look more like
                public void setDeptno(ValueChangeEvent valueChangeEvent) {
                    BindingContainer b = getBindings();
                    OperationBinding oB = b.getOperationBinding("setDeptno");
                    //Checking instance of because same method is called from another text inputText item.
                    if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
                        CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
                    if (columnName.getId().toString().equals("deptDname")){
                        FacesContext ctx = FacesContext.getCurrentInstance();
                        Application app = ctx.getApplication();
                        ValueBinding bind = app.createValueBinding("#{bindings.Dept1Iterator.currentRow}");
                        Row row = (Row)bind.getValue(ctx);
                        JSFUtils.setManagedBeanValue("dept.deptDeptno", row.getAttribute("deptno"));
                } I haven't tested it, so it could perfectly not work at all

Similar Messages

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • How to get selected value from selectOneRadio ???

    Hi...i want to how to get selected value from selectOneRadio and use it in another page and in backing bean.
    Note i have about 10 selectOneRadio group in one page i want to know value of each one of them.
    Plzzzzzzzz i need help

    You have a datatable in which each row is a question, correct?
    Also in each row you have 5 possible answers that are in a radio, correct?
    So,
    You need to put in your datatable model, a question, and a list of answers (5 in yor case) and the selected one.
    So you will have a get to the question, an SelectItem[] list to populate the radios and another get/set to the selected question.
    ex:
    <h:selectOneRadio value="#{notas.selectedString}" id="rb">
    <f:selectItem itemValue="#{notas.valuesList}"/>
    </h:selectOneRadio>
    Search the web for examples like yours.

  • How to get selected value from OADefaultListBean.

    Hi All,
    How to get selected value from OADefaultListBean ?
    Thanks,

    Hi,
    To identify the user's selection(s) when the page is submitted, you would add the following logic to your processFormRequest() method:
    OADefaultListBean list =
    (OADefaultListBean)webBean.findChildRecursive("positionsList");
    String name = list.getName();
    String[] selectedValues = pageContext.getParameterValues(name);
    To retrieve all the values in the list box, call list.getOptionsData().
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Dvt:pivotFilterBar - how to get selected values from filter

    Hi all,
    I have a question: how to programmatically get selected values from pivot table's filter bar?
    I have tried to use
    pivotTable.getDataModel().getDataAccess().getValueQDR(startRow, startCol, DataAccess.QDR_WITH_PAGE);but for page edge dimensions it returns BAD DATA, it seems that it returns some cached values.
    Environment: JDev 11.1.1.3.0 without any patches.
    thanks,
    Miroslaw

    Hi,
    You can retrieve the selected value in the PivotFilterBar through the model of PivotFilterBar, instead of dataaccess:
    // get the model from the pivot filter bar instance
    QueryDescriptior queryDescriptor = (QueryDescriptor)pivotFilterBar.getValue();
    // retrieve a list of criterion, each one is used to populate each lov within the pivot filter bar
    ConjunctionCriterion conjunctionCriterion = queryDescriptor.getConjunctionCriterion();
    List<Criterion> criterionList = conjunctionCriterion.getCriterionList();
    for (int i=0; i<_criterionList.size(); i++) {
    AttributeCriterion criterion = (AttributeCriterion)criterionList.get(i);
    // _selected is the currently selected value
    Object selected = criterion.getValues().get(0);
    System.out.println(_selected);
    Hope that helps,
    Chadwick

  • How to get selected values from selectManyCheckbox ?

    Hi,
    I am a SOA developer and using 'Auto generated adf form' of Human Task. I did some customization in the form. I need to show one dynamic list (contains multiple string values) on a form, from which user will select desired values. For this I have used <af:selectManyCheckbox> adf component.
    It has generated code as follows...
    <af:selectManyCheckbox value="#{bindings.Response.inputValue}"
                                             label="#{bindings.Response.label}"
                                             id="smc1">
                        <f:selectItems value="#{bindings.Response.items}" id="si9"/>
    </af:selectManyCheckbox>
    I am able to show list on a form and can select multiple values also.
    Now, I want the multiple selected values back in my BPEL process. I need only those values which are selected by user.
    Currently I am getting complete list as it is back in BPEL process.
    Please help me out..!
    Thanks..
    Suraj

    Unwinding ADF: How to retrieve Selected Items from selectManyCheckbox using ValueChnageListener

  • How to get selected value from a listbox

    Hi !
    I use following code to fill in my LISTBOX with values :
    AT SELECTION-SCREEN OUTPUT.
      val-key = 1.
      val-text = '0016'.
      APPEND val TO list_values.
      val-key = 2.
      val-text = '0028'.
      APPEND val TO list_values.
      val-key = 3.
      val-text = '0035'.
      APPEND val TO list_values.
      val-key = 4.
      val-text = '2001'.
      APPEND val TO list_values.
      val-key = 5.
      val-text = '0515'.
      APPEND val TO list_values.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING id     = 'p_list'
                  values = list_values.
    My question is - how to get a selected key/text value ? i dont need it to be done dynamically - i just need it in START OF SELECTION to perform tasks.
    Thx in advance.

    Unfortunetly it does not work
    i Define parameter as follows :
    PARAMETERS:
      p_list AS LISTBOX VISIBLE LENGTH 10.
    Then i add values to it :
    AT SELECTION-SCREEN OUTPUT.
      val-key = 1.
      val-text = '0016'.
      APPEND val TO list_values.
      val-key = 2.
      val-text = '0028'.
      APPEND val TO list_values.
      val-key = 3.
      val-text = '0035'.
      APPEND val TO list_values.
      val-key = 4.
      val-text = '2001'.
      APPEND val TO list_values.
      val-key = 5.
      val-text = '0515'.
      APPEND val TO list_values.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING id     = 'p_list'
                  values = list_values.
    Then when i add a blank section :
    AT SELECTION-SCREEN ON p_list.
    I set a breakpoint in START OF SELECTION block - but the value is empty no matter what do i select.
    Actually when i select value from the list and hit enter key on selection screen the selection in a listbox goes empty :/
    Whats the cause of this ?
    Edited by: Jacek Zebrowski on Feb 26, 2009 12:38 PM

  • How to get selected value from one choice list

    Hi All,
    i want to get selected value in onechoice list.how to achive this
    Regards,
    Smaran

    check these
    http://groundside.com/blog/DuncanMills.php?title=adf_the_list_binding_value_problem&more=1&c=1&tb=1&pb=1
    http://blogs.oracle.com/jdevotnharvest/2010/12/reading_the_selected_value_of_an_adf_bound_select_list_in_java.html
    http://www.oracle.com/technetwork/developer-tools/jdev/listbindingvalue-088449.html

  • How to get selected values from Select Many Choice List

    Hello All -
    I am using Select Many Choice List and wish to get the selected values in the bean. I have created method binding for valueChangeListener for the choice list, but not sure how to get the selected values.
    I am facing problem in getting values from valueChangeEvent.getNewValue(). For Select One Choice List this returns int, but some list type object for Select Many Choice List.
    When I try to print the value it comes something like:
    ArrayList newVal = new ArrayList(Arrays.asList(valueChangeEvent.getNewValue()));
    System.out.println(newVal);
    [Ljava.lang.Integer;@870ad8
    Could anyone please suggest how to type cast and use the return of valueChangeEvent.getNewValue() to get the selected values.
    Regards -
    Rohit

    Hi Timo -
    Thanks for the suggestion. I could get the values as below:
    public void multiOpUnitValChange(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding opUnitIter = (DCIteratorBinding)bindings.get("OperatingUnit2VOIterator");
    Integer[] values = (Integer[])valueChangeEvent.getNewValue();
    for (int i=0; i<values.length; i++){
    Row row = opUnitIter.getRowAtRangeIndex(i);
    System.out.println(row.getAttribute("OpUnitId"));
    Thanks -
    Rohit

  • How to get selected values from tableSelectMany

    Hi all,
    I have a view object which displays all column names of a table. I created a tableselectmany table with the view object.
    the user has to select some rows (for mining function).
    how to get the selected rows from tableselectmany table?
    what should be in 'action' and 'actionlistener' ?
    thanks in advance.

    test(Set<Key> empKeys){
    System.out.println("Inside function");
    for(Key keys:empKeys){
    Row[] row = getCollectionsView1().findByKey(keys,1);
    EewCollectionsViewRowImpl vo = (CollectionsViewRowImpl)row[0];
    In the action just call this method(test)
    and pass the argument as #{applicationScope.managedBean.firstProperty.selectionState.keySet}
    I hope this works for you.

  • How to get selected values from af:selectManyCheckbox

    Hi i am using jdeveloper 11.1.2 and i drag n drop a view object as Multiple select (<af:selectManyCheckbox) component and now i am trying to get the checked values in backing bean so that i can save in the database.
    Right now i am getting all the values but not the selected values.
    JSPX Page.
    <af:selectManyCheckbox value="#{bindings.HREmpDetailsVO1.inputValue}"
    label="EMPLOYEES"
    binding="#{backingBeanScope.backing_TestForm.smc1}"
    id="smc1">
    <f:selectItems value="#{bindings.HREmpDetailsVO1.items}"
    binding="#{backingBeanScope.backing_TestForm.si1}"
    id="si1"/>
    </af:selectManyCheckbox>
    Bean Class:
    public List getSelectedValues() {
    if (selectedValues == null || refreshSelectedList) {
    selectedValues =
    attributeListForIterator(selectedValuesIteratorName,
    selectedValuesValueAttrName);
    return selectedValues;
    public static List attributeListForIterator(DCIteratorBinding iter,
    String valueAttrName) {
    List attributeList = new ArrayList();
    for (Row r : iter.getAllRowsInRange()) {
    attributeList.add(r.getAttribute(valueAttrName));
    return attributeList;
    Can some one pls help me in getting the values with sample code.
    Thanks in advance

    Thank you so much for your help. But i am getting null values in the SOP. I could get count of selected values but not the values.

  • How to get selected values from datatable with paging

    hi all
    here is my problem
    I have a datatable with paging size of 2 and first column as checkbox.
    now i have total record of 5 data,2 row on each page.
    Now i m selecting 1-1 row from each page.
    When i m clicking Command button to display all the selected row from different page ,i m only able to display values selected from last page.
    Through debug i can see that only last page value is set to TRUE OR FALSE and every other value is neither true nor false.
    any help???
    thanks

    <f:facet name="footer">
    <h:panelGroup binding="#{Page1.groupPanel1}" id="groupPanel1"
    style="display: block; text-align: center" styleClass="list-paging-footer">
    <h:commandButton action="#{Page1.dataTable1_firstPageAction}" binding="#{Page1.dataTable1FooterFirstButton}" id="dataTable1FooterFirstButton" image="resources/paging_first.gif" immediate="true"/>
    <h:commandButton action="# Page1.dataTable1_previousPageAction}" binding="#{Page1.dataTable1FooterPreviousButton}"
    id="dataTable1FooterPreviousButton" image="resources/paging_previous.gif" immediate="true"/>
    <h:commandButton action="#{Page1.dataTable1_nextPageAction}" binding="#{Page1.dataTable1FooterNextButton}"
    id="dataTable1FooterNextButton" image="resources/paging_next.gif" immediate="true"/>
    <h:commandButton action="#{Page1.dataTable1_lastPageAction}" binding="#{Page1.dataTable1FooterLastButton}"
    id="dataTable1FooterLastButton" image="resources/paging_last.gif" immediate="true"/>
    </h:panelGroup>
    </f:facet>
    Above is the code which i m using for paging which is command button
    Any problem with it.???
    thanks

  • How to get selected value from a Table?

    Dear Friends,
    when i select a value form the table i want that value to be passed to controller for deleting that record,
    please help in understaning what code must i write for the same?
    the  "Zpms_Master_Input.Output.It_P9001.Employee_Code" is the first field which i want to capture in some context or temp. variable to pass it on to controller for further porcessing.
    please give a sample code on how do i catch this employee code value and use it for my processing.
    Regards,
    Jack
    Edited by: Jack on Dec 6, 2011 11:20 AM

    Hi Kumar you have perfectly understood my requirement .... i tried coding as per your suggestion but not able to get through ...it seems with little help i would make it... the code i am writing here is as follows.
    input.setMode("DEL" );          
    P9009 inputParaABC = new P9009();     
    //inputParaABC.setEmployee_Code("2134"); ---> when i pass a hard coded employee code value i am able to delete
    //<your variable> = wdContext.current<tableNodeElement>.get<fieldname> ; --> your suggestion
    inputParaABC.setEmployee_Code(wdContext.currentIt_P9009Element().getEmployee_Code()); 
                              --> Here as per your  suggestion i am not getting a <tableNodeElement> prompt by the system, it only gives
                              --> wdContext.currentIt_P9009Element() or .createOutputElement etc but no tableNode
    the above code i have wriiten on the Controller where in am executing the RFC, how do we adjust the TableNodeElement thing in my code?? 
    Please help.

  • How to get the values from html:select? tag..?

    i tried with this, but its not working...
    <html:select styleClass="text" name="querydefs" property="shortcut"
                 onchange="retrieveOptions()" styleId="firstBox" indexed="true">
    <html:options collection="advanced.choices" property="shortcut" labelProperty="label" />
    </html:select>
                        <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>

    <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>This java script is not working at all..its not printing anything in document.write();
    This is code..
    <td class="rowcolor1" width="20%">
    <html:select styleClass="text" name="querydefs" property="shortcut"
                             onchange="retrieveSecondOptions()" styleId="firstBox"
                             indexed="true">
                             <html:options collection="advanced.choices" property="shortcut"
                                  labelProperty="label"  />
                        </html:select>i tried with this also. but no use..i'm not the getting the seleced option...
    function retrieveOptions(){
    firstBox = document.getElementById('firstBox');
                             if(firstBox.selectedIndex==0){
          return;
        selectedOption = firstBox.options[firstBox.selectedIndex].value;
    }actually , how to get the values from <html:select> ...?
    my idea is to know which value is selected from the combo box(<html:select> ) if that value is equal some string i have enable a hyperlink to open a popup window

  • How to get the values from popup window to mainwindow

    HI all,
       I want to get the details from popup window.
          i have three input fields and one search button in my main window. when i click search button it should display popup window.whenever i click on selected row of the popup window table ,values should be visible in my main window input fields.(normal tables)
       now i am able to display popup window with values.How to get the values from popup window now.
       I can anybody explain me clearly.
    Thanks&Regards
    kranthi

    Hi Kranthi,
    Every webdynpro component has a global controller called the component controller which is visible to all other controllers within the component.So whenever you want to share some data in between 2 different views you can just make it a point to use the component controller's context for the same. For your requirement (within your popups view context) you will have have to copy the component controllers context to your view. You then will have to (programmatically) fill this context with your desired data in this popup view. You can then be able to read this context from whichever view you want. I hope that this would have made it clear for you. Am also giving you an [example|http://****************/Tutorials/WebDynproABAP/Modalbox/page1.htm] which you can go through which would give you a perfect understanding of all this. In this example the user has an input field in the main view. The user enters a customer number & presses on a pushbutton. The corresponding sales orders are then displayed in a popup window for the user. The user can then select any sales order & press on a button in the popup. These values would then get copied to the table in the main view.
    Regards,
    Uday

Maybe you are looking for