SelectOneChoice values as values

Hi,
Is it possible to have selectOneChoice/selectItems, with values as values and not with indexes as values?

Thank you,
But it doesn't work. If I put valuePassThru to "true", option tags's values are always indexes and not real values. Maybe beacause I have selectOneChoice value pointing to bindings attribute and selectItems value pointing to another attribute?
<af:selectOneChoice label="Label 1" id="soc1"
                                       value="#{row.bindings.DydValue.inputValue}"
                                       autoSubmit="true" valuePassThru="true">
                    <f:selectItems value="#{row.bindings.ValueWithLov.items}" id="si1"/>
           </af:selectOneChoice>I have these 2 different attributes beacause I want the user to update first attribute, but this attribute is not always with LOV, so I create the second transient attribute, just to populate the selectOneChoice.

Similar Messages

  • How to get SelectOneChoice value from a af:Table

    JDeveloper v11.1.2.4.0 - JSF
    Greetings,
    im having a problem getting a column value that is a select one choice object.
    This is not a common problem since i actually did different thing than others so please follow my problem
    description and if you have any answer/questions please reply below.
    I have create a Database View that returns me 3 columns, lets say TestCode, TestDescription, TestValue.
    I have added one extra temporally column in my OV and called Temp.
    I drag & drop my OV, delete Temp value, and its column position, i drag&drop a LOV that is from another View,
    that shows me Doctor's name & surname and return doctor's id as select one choice value.
    Im using a function that go thru the iterator, gets the rows, and save them in database (doesn't matter how).
    The problem is, my selectonechoice, do not have row.bindings.DoctorId.InputValue but bindings.DoctorId.InputValue instead, so i can retrieve the current row's selectonechoice value.
    So when my loop is finish and insert the rows in to my database, all row's doctor's id is the same since the binding do not change thru the loop.
    I don't know how to get the current row's select one choice value to use the correct value on each row loop.
    Here is my loop function:
            DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding iterator = bc.findIteratorBinding("ExaminationsIterator");
            DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
             RowSetIterator rsi = iterator.getRowSetIterator(); 
             int i=0;
            OperationBinding save_exams = bindings.getOperationBinding("SAVE_EXAMINATION");
            OperationBinding save_exams_commit = bindings.getOperationBinding("SAVE_EXAMINATION_COMMIT");
            try{
             while(i < rsi.getRowCount()){
                 Row r = iterator.getCurrentRow();
                 save_exams.getParamsMap().put("CodeTest", r.getAttribute("CodeTest"));
                 save_exams.getParamsMap().put("Dates", r.getAttribute("Dates"));  
                 save_exams.getParamsMap().put("CodeId", orderid.getValue());  
                 save_exams.getParamsMap().put("Times", r.getAttribute("Times"));   
                 save_exams.getParamsMap().put("DoctorId", resolveExpression("#{bindings.DoctorId.attributeValue}").toString());
                 save_exams.getParamsMap().put("IdPatients", patientid.getValue());  
                 save_exams.execute();
                 rsi.next();
                 i++;
                save_exams_commit.execute();
    I get the current doctor's id binding and not each row's value.
    Can you assist me on this please?

    I have created a work around solution, until any more expert than me come with more advance solution.
    1) I add a LOV at doctor's id on target View object.
    2) On runtime, i populate my Database View
    3) go through all rows in my DB View iterator
    4) add each row on the target View Object (missing the doctor's id, since i want that to be on runtime) & commit rows
    5) after the loop is done and the target view object show me the results of the DB View, i choose on runtime the doctor's id and commit the changes so
    the new rows, with new updated date will be finally populated to the database.
    Hope this helps if anyone have a similar task.
    Please let me know if you find a more direct solution, that working with 2 tables to populate 1.

  • Cannot set selectOneChoice value during reload (value auto become null)

    Dear all,
    I have a problem that getting null value in the SelectOneChoice field in a table binded to
    a view object. If I change that SelectOneChoice to inputText, it works perfectly. The details
    of the situation is described as follows:
    I've binded a view objects with 8 attributes to a af:table, then I manually change
    2 of the inputText fields inside 'Column' fields of the table to inputlistofvalue and
    selectOneChoice. The code is as follow:
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.AcNo.name}"
    sortable="false"
    headerText="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
    id="c1" width="180"
    inlineStyle="font-family:'Times New Roman', 'Arial Black', times, Serif; font-size:medium;">
         <af:inputListOfValues value="#{row.bindings.AcNo.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
              required="#{bindings.OpenBalanceVO1.hints.AcNo.mandatory}"
              columns="#{bindings.OpenBalanceVO1.hints.AcNo.displayWidth}"
              maximumLength="#{bindings.OpenBalanceVO1.hints.AcNo.precision}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.AcNo.tooltip}"
              id="it1"
              model="#{bindings.AcNo2.listOfValuesModel}"
              autoSubmit="false"
              returnPopupListener="#{backingBeanScope.backing_ImportOpenBalance.returnListener}">
              <f:validator binding="#{row.bindings.AcNo.validator}"/>
         </af:inputListOfValues>
    </af:column>
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.CurrencyCode.name}"
         sortable="false"
         headerText="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
         id="c2">
         <af:selectOneChoice value="#{row.bindings.CurrencyCode.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.CurrencyCode.tooltip}"
              id="it2" autoSubmit="false"
              partialTriggers="cb1 cb2">
              <f:selectItems value="#{loginInfo.activeCurrencies}" id="currenciesList"/>
         </af:selectOneChoice>
    </af:column>
    And I have binded the returnPopupListener to returnListerner event handler to automatically
    set the Currency field (2nd field) after the user chose the Account field (1st field) from
    the input list of value:
    public void returnListener(ReturnPopupEvent returnPopupEvent) {
         RichInputListOfValues lovField = (RichInputListOfValues)returnPopupEvent.getSource();
         ListOfValuesModel lovModel = lovField.getModel();
         CollectionModel collectionModel = lovModel.getTableModel().getCollectionModel();
         JUCtrlHierBinding treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
         RowKeySet rks = (RowKeySet)returnPopupEvent.getReturnValue();
         List tableRowKey = (List)rks.iterator().next();
         DCIteratorBinding dciter = treeBinding.getDCIteratorBinding();
         Key key = (Key)tableRowKey.get(0);
         Row row = dciter.findRowByKeyString(key.toStringFormat(true));
         DCBindingContainer bc = getBindingContainer();
         DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
         OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
         FacesContext fctx = FacesContext.getCurrentInstance();
         ExpressionFactory elFactory = fctx.getApplication().getExpressionFactory();
         ValueExpression ve = elFactory.createValueExpression(fctx.getELContext(), "#{loginInfo}", LoginInfo.class);
         LoginInfo loginInfo = (LoginInfo)ve.getValue(fctx.getELContext());
         System.out.println("Return place: search date:" + loginInfo.getSearchDate());
         Row newRow = viewObject.createRow();
         String selectedAcNo = row.getAttribute("AcNo").toString();
         String selectedCurrency = row.getAttribute("CurrencyCode").toString();
         newRow.setAttribute("AcNo", selectedAcNo);
         newRow.setAttribute("CurrencyCode",selectedCurrency);
         newRow.setAttribute("OpenBal", 300);
         newRow.setAttribute("AvailBal", 200);
         newRow.setAttribute("CreateDate", new Date());
         newRow.setAttribute("EffectiveDate", loginInfo.getSearchDate());
         newRow.setAttribute("LockStatus", "N");
         viewObject.insertRowAtRangeIndex(rowIndex, newRow);
    The problem occurs when I use a 'createInsert' button to create a new row in the table,
    and then choose a value from the inputListOfValues. The new row refresh and get the value
    I chose in the first column in the new row. But the second column (currency field) is left
    as empty (null value). If I change the second column frmo selectOneChoice to inputText,
    the correct Currency value (e.g. "HKD" or "USD") can be shown. So I wonder if there is any
    additional tricks in order to set the selectOneChoice value during refresh.
    Additionally I have tried to check the state of the view object attributes during the refresh
    lifecycle and found that the following reload method (else place) is being reached 3 times after I click
    the 'ok' button in the popup up in the inputListOfValue.
    public void beforePhase(PagePhaseEvent event) {
         //System.out.println("i am here inside backing bean : before phrase 1 phrase ID:" + event.getPhaseId());
         if (event.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
              if (!isPostback()) {
              } else {
                   System.out.println("Post Back on Page Load!");
                   DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
                   OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
                   RowSetIterator iterator = viewObject.createRowSetIterator(null);
                   iterator.reset();
                   while (iterator.hasNext()) {
                        //Row row = viewObject.getCurrentRow();
                        Row row = iterator.next();
                        System.out.print("Account:" + row.getAttribute("AcNo"));
                        System.out.print(",AvailBal:" + row.getAttribute("AvailBal"));
                        System.out.print(",OpenBal:" + row.getAttribute("OpenBal"));
                        System.out.print(",CurrencyCode:" + row.getAttribute("CurrencyCode"));
                        System.out.print(",EffectiveDate:" + row.getAttribute("EffectiveDate"));
                        System.out.print(",UserCreate:" + row.getAttribute("UserCreate"));
                        System.out.println("");
                        if (row.getAttribute("UserCreate").toString().equals("<current user>")) {
                             System.out.println("Match <current user> in preload");
                             //row.setAttribute("CurrencyCode", "USD");
                   System.out.println("end of reload");
    During the 1st time, the CurrencyCode field was set currently, but then in the 2nd and 3rd
    times, it's value suddenly changed to 'null'. If I use inputText, all the 3 times currencyCode
    field is showing correctly without the null issue.
    Anyone can kindly give me some hints? Thanks a lot!!!

    Dear all,
    I have a problem that getting null value in the SelectOneChoice field in a table binded to
    a view object. If I change that SelectOneChoice to inputText, it works perfectly. The details
    of the situation is described as follows:
    I've binded a view objects with 8 attributes to a af:table, then I manually change
    2 of the inputText fields inside 'Column' fields of the table to inputlistofvalue and
    selectOneChoice. The code is as follow:
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.AcNo.name}"
    sortable="false"
    headerText="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
    id="c1" width="180"
    inlineStyle="font-family:'Times New Roman', 'Arial Black', times, Serif; font-size:medium;">
         <af:inputListOfValues value="#{row.bindings.AcNo.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.AcNo.label}"
              required="#{bindings.OpenBalanceVO1.hints.AcNo.mandatory}"
              columns="#{bindings.OpenBalanceVO1.hints.AcNo.displayWidth}"
              maximumLength="#{bindings.OpenBalanceVO1.hints.AcNo.precision}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.AcNo.tooltip}"
              id="it1"
              model="#{bindings.AcNo2.listOfValuesModel}"
              autoSubmit="false"
              returnPopupListener="#{backingBeanScope.backing_ImportOpenBalance.returnListener}">
              <f:validator binding="#{row.bindings.AcNo.validator}"/>
         </af:inputListOfValues>
    </af:column>
    <af:column sortProperty="#{bindings.OpenBalanceVO1.hints.CurrencyCode.name}"
         sortable="false"
         headerText="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
         id="c2">
         <af:selectOneChoice value="#{row.bindings.CurrencyCode.inputValue}"
              label="#{bindings.OpenBalanceVO1.hints.CurrencyCode.label}"
              shortDesc="#{bindings.OpenBalanceVO1.hints.CurrencyCode.tooltip}"
              id="it2" autoSubmit="false"
              partialTriggers="cb1 cb2">
              <f:selectItems value="#{loginInfo.activeCurrencies}" id="currenciesList"/>
         </af:selectOneChoice>
    </af:column>
    And I have binded the returnPopupListener to returnListerner event handler to automatically
    set the Currency field (2nd field) after the user chose the Account field (1st field) from
    the input list of value:
    public void returnListener(ReturnPopupEvent returnPopupEvent) {
         RichInputListOfValues lovField = (RichInputListOfValues)returnPopupEvent.getSource();
         ListOfValuesModel lovModel = lovField.getModel();
         CollectionModel collectionModel = lovModel.getTableModel().getCollectionModel();
         JUCtrlHierBinding treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
         RowKeySet rks = (RowKeySet)returnPopupEvent.getReturnValue();
         List tableRowKey = (List)rks.iterator().next();
         DCIteratorBinding dciter = treeBinding.getDCIteratorBinding();
         Key key = (Key)tableRowKey.get(0);
         Row row = dciter.findRowByKeyString(key.toStringFormat(true));
         DCBindingContainer bc = getBindingContainer();
         DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
         OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
         FacesContext fctx = FacesContext.getCurrentInstance();
         ExpressionFactory elFactory = fctx.getApplication().getExpressionFactory();
         ValueExpression ve = elFactory.createValueExpression(fctx.getELContext(), "#{loginInfo}", LoginInfo.class);
         LoginInfo loginInfo = (LoginInfo)ve.getValue(fctx.getELContext());
         System.out.println("Return place: search date:" + loginInfo.getSearchDate());
         Row newRow = viewObject.createRow();
         String selectedAcNo = row.getAttribute("AcNo").toString();
         String selectedCurrency = row.getAttribute("CurrencyCode").toString();
         newRow.setAttribute("AcNo", selectedAcNo);
         newRow.setAttribute("CurrencyCode",selectedCurrency);
         newRow.setAttribute("OpenBal", 300);
         newRow.setAttribute("AvailBal", 200);
         newRow.setAttribute("CreateDate", new Date());
         newRow.setAttribute("EffectiveDate", loginInfo.getSearchDate());
         newRow.setAttribute("LockStatus", "N");
         viewObject.insertRowAtRangeIndex(rowIndex, newRow);
    The problem occurs when I use a 'createInsert' button to create a new row in the table,
    and then choose a value from the inputListOfValues. The new row refresh and get the value
    I chose in the first column in the new row. But the second column (currency field) is left
    as empty (null value). If I change the second column frmo selectOneChoice to inputText,
    the correct Currency value (e.g. "HKD" or "USD") can be shown. So I wonder if there is any
    additional tricks in order to set the selectOneChoice value during refresh.
    Additionally I have tried to check the state of the view object attributes during the refresh
    lifecycle and found that the following reload method (else place) is being reached 3 times after I click
    the 'ok' button in the popup up in the inputListOfValue.
    public void beforePhase(PagePhaseEvent event) {
         //System.out.println("i am here inside backing bean : before phrase 1 phrase ID:" + event.getPhaseId());
         if (event.getPhaseId() == Lifecycle.PREPARE_MODEL_ID) {
              if (!isPostback()) {
              } else {
                   System.out.println("Post Back on Page Load!");
                   DCIteratorBinding it2 = bc.findIteratorBinding("OpenBalanceVO1Iterator");
                   OpenBalanceVOImpl viewObject = (OpenBalanceVOImpl)it2.getViewObject();
                   RowSetIterator iterator = viewObject.createRowSetIterator(null);
                   iterator.reset();
                   while (iterator.hasNext()) {
                        //Row row = viewObject.getCurrentRow();
                        Row row = iterator.next();
                        System.out.print("Account:" + row.getAttribute("AcNo"));
                        System.out.print(",AvailBal:" + row.getAttribute("AvailBal"));
                        System.out.print(",OpenBal:" + row.getAttribute("OpenBal"));
                        System.out.print(",CurrencyCode:" + row.getAttribute("CurrencyCode"));
                        System.out.print(",EffectiveDate:" + row.getAttribute("EffectiveDate"));
                        System.out.print(",UserCreate:" + row.getAttribute("UserCreate"));
                        System.out.println("");
                        if (row.getAttribute("UserCreate").toString().equals("<current user>")) {
                             System.out.println("Match <current user> in preload");
                             //row.setAttribute("CurrencyCode", "USD");
                   System.out.println("end of reload");
    During the 1st time, the CurrencyCode field was set currently, but then in the 2nd and 3rd
    times, it's value suddenly changed to 'null'. If I use inputText, all the 3 times currencyCode
    field is showing correctly without the null issue.
    Anyone can kindly give me some hints? Thanks a lot!!!

  • Refreshing af:selectOneChoice values in multi-user environment

    Imagine the following scenario:
    a) User 1 is looking at a af:selectOneChoice on a web (ADF Faces) page showing some data
    b) User 2 inserts a new row in the table (from different jsf page) whose data is shown on that af:selectOneChoice, and commits that new row
    I need I way for the User 1 to see newly inserted row as a choice in the af:selectOneChoice.
    So, here is relevant part of code:
                                <af:selectOneChoice value="#{bindings.LokacijaId.inputValue}"
                                                    label="#{bindings.LokacijaId.label}"
                                                    binding="#{tradingTicketBacking.selectOneChoice15}"
                                                    id="selectOneChoice15"
                                                    showRequired="true">
                                  <f:selectItems value="#{bindings.LokacijaId.items}"
                                                 binding="#{tradingTicketBacking.selectItems16}"
                                                 id="selectItems16"/>
                                </af:selectOneChoice>- and here is relevant part of pageDef :
        <list IterBinding="TeeTradingTicketVOIterator" Uses="LOV_LokacijaId"
              id="LokacijaId">
          <AttrNames>
            <Item Value="LokacijaId"/>
          </AttrNames>
        </list>So, how to refresh values in the af:selectOneChoice, in order to see changes made by another user ?
    I have the same question for data displayed in a af:table - how to make changes made by another user to be automatically visible for the first user ? What is the best way to achieve this ?
    I am using ADF BC, and when I say "automatically", I mean "after User 1 made form submit in any way (partial or not)"
    Message was edited by:
    Cwele
    Message was edited by:
    Cwele

    After user 1 submits the page, it might not even be committed, so there is no way to have the pending data from user1 seen by user2.
    However, we do have a new feature in ADF 11g TP4 that I plan to blog more about called Auto-Refresh view objects. This feature allows a view object instance in a shared application module to refresh its data when it receives the Oracle 11g database change notification that a row that would affect the results of the query has been changed.
    The minimum requirements in 11g TP4 to experiment with this feature which I just tested are the following:
    1. Must use Database 11g
    2. Database must have its COMPATIBLE parameter set to '11.0.0.0.0' at least
    3. Set the "AutoRefresh" property of the VO to true (on the Tuning panel)
    4. Add an instance of that VO to an application module (e.g. LOVModule)
    5. Configure that LOVModule as an application-level shared AM in the project properties
    6. Define an LOV based on a view accessor that references the shared AM's VO instance
    7. DBA must have performed a 'GRANT CHANGE NOTIFICATION TO YOURUSER'
    8. Build an ADF Form for the VO that defined the LOV above and run the web page
    9. In SQLPlus, go modify a row of the table on which the shared AM VO is based and commit
    When the Database delivers the change notification, the shared AM VO instance will requery itself.
    However that notification does not arrive all the way out to the web page, so you won't see the change until the next time you repaint the list.
    Perhaps there is some way to take it even farther with the active data feature PaKo mentions, but I'm not familiar enough with that myself to say whether it would work for you hear.

  • Setting the selectOneChoice value at runtime

    Hi,
    I need to set the selectOneChoice value at runtime. On Page Load I am creating object of RichSelectOneChoice and currencyCode.setValue("USD");
    When I check on runtime it is not showing "USD" as selected item in dropdown where as in background it is sending USD to downstream application.
    How to get the show the value in SelectOneChoice which is selected at runtime in code?
    Thanks in advance.

    Hi,
    Selected value will be taken from the value property of selectOneChoice component, I guess you don't have specified value property. Create a String instance variable in bean and then set the value 'USD' to this variable and then bind it to value property of selectOneChoice component.
    Sample:
    //inside bean
    private String selectedValue;
    //Getter and Setter methods
    //Replace the currencyCode.setValue("USD"); line with the below code
    this.selectedValue = "USD"
    //Finally in jspx page bind this selectedValue to value property of bean
    <af:selectOneChoice value="#{bean.selectedValue}" ... />Sireesha

  • SelectOneChoice value

    I have a ad selectOneChoice related with a ViewObject:
    <af:selectOneChoice value="#{bindings.DocumentoVista.inputValue}"
    label="Tipo Documento:"
    required="#{bindings.DocumentoVista.hints.mandatory}"
    shortDesc="#{bindings.DocumentoVista.hints.tooltip}"
    id="schoDocumento"
    valueChangeListener="#{backingBeanScope.Usuario.selectTipoDocumento_valueChangeListener}"
    binding="#{backingBeanScope.Usuario.selectTipoDocumento}">
    <f:selectItems value="#{bindings.DocumentoVista.items}"
    </af:selectOneChoice>
    The View has the code and the description of the document. When the user select this selectOneChoice i want to get the code of the document selected to pass it to a query for validate. As you can see i have a backingbean whit a method:
    public void selectTipoDocumento_valueChangeListener(ValueChangeEvent valueChangeEvent) {    
    tipoDocumento = valueChangeEvent.getNewValue().toString();
    }

    Hi,
    the first question is the most difficult to answer. Looking into my crystal ball here on my desk, I guess its that you get an index value instead of the selected value. Not sure I am correct because you don't tell and my abilities to predict future and truth became rusty.
    Assuming I am right, then you can try as follows
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingEntry();
    JUCtrlListBinding list = (JUCtrlListBinding ) bindings.get("name-of-list-binding-in-PageDef");
    Object value = list.getSelectedValue();
    if this doesn't produce the selected value, try
    Object value = list.getAttributeValue();
    Note that your sample has another issue, which is that the target source is the same View Object as the list source. These need to be different though
    Frank

  • Keep selectonechoice value

    Hi,
    I'm facing a problem with SelectOneChoice wich is configured as a dynamic list. Base data source is variable, List data source is View object, and labeled item is included. When I go to another page, and after that return, value of SelectOneChoice is blank item. How can I avoid selectonechoice from reseting and keep previously selected item in list?
    Thanks in advance
    Dragana

    Hi Dragna,
         When you go to the other page or when the value is selected you can record the currently selected value from the selectOneChoice object in a sesssionBean or by some other means.
         If you want to store it on a session bean.
         Create a session bean.
         Create a a managed property on the session bean.
         When you navigate to the new page or when the value is set record the selected value on property you created on the session bean.
         FacesContext ctx = FacesContext.getCurrentInstance();
         MySessionBean mySessionBean =(MySessionBean)JSFUtils.getManagedBeanValue(ctx, "mySessionBean");
         mySessionBean.setSelectedValue(selectOneChoice1.getValue);
         There is a method on backing bean which should look like this.
         public void setSelectOneChoice1(CoreSelectOneChoice selectOneChoice1) {       
    this.selectOneChoice1 = selectOneChoice1;
         Add code similar to below
         public void setSelectOneChoice1(CoreSelectOneChoice selectOneChoice1) {       
    this.selectOneChoice1 = selectOneChoice1;
         FacesContext ctx = FacesContext.getCurrentInstance();
         MySessionBean mySessionBean =(MySessionBean)JSFUtils.getManagedBeanValue(ctx, "mySessionBean");
         selectOneChoice1.setValue(mySessionBean.getSelectedValue());
         Now the value will be set when the page is painted unless something updates or happens to the data that populates the list.
         If you are concerned about the list being updated and the value no longer being present in the list or the order changed etc. You should record the value you are interested from
         the list that populates the selectOneChoice select items and set the selectOneChoice value to its position in the list when the user returns to the page.
         You can retrieve the results on bindings as follows.
         OperationBinding myBinding = bindings.getOperationBinding("myBinding");
         List l = ((List)myBinding.getResult()).get(0);
         int i = 0;
         boolean notFound = true;
         MyObject myObject= null;
         while (i < l.size() && notFound){
              myObject = (MyObject) l.get(i);
              if (myObject.mySelectItem = selectItem){
                   notFound = false;
         this.selectOneChoice1.setValue(new Integer(i));
         Kind regards,
              Richie.

  • How to set the Selectonechoice Value associated with MethodAction

    Hi All,
    I am using Jdeveloper 11.1.1.5 and i have a two textbox on my page and one selectonechoice.I am fetching the values from the Master Table in the dropdown by sending the supplierVatId and SupplierPostCode and the base dataSource of the selectonechoice is my transaction table(InvoiceHeaderTable).
    My jspx page source is :-
    <af:inputText value="#{bindings.Suppostcode.inputValue}"
    binding="#{backingBeanScope.backing_parkSupplierId.it7}"
    id="it7">
    </af:inputText>
    <af:inputText value="#{bindings.Suppvatid.inputValue}"
    binding="#{backingBeanScope.backing_parkSupplierId.it8}"
    id="it8">
    <f:validator binding="#{bindings.Suppvatid.validator}"/>
    </af:inputText>
    </af:panelFormLayout>
    <af:selectOneChoice value="#{bindings.supplierid.inputValue}"
    binding="#{GeneralManagedBean.suppid}"
    id="soc1">
    <f:selectItems value="#{bindings.supplierid.items}"
    binding="#{GeneralManagedBean.suppiditems}"
    id="si1"/>
    </af:selectOneChoice>
    and this is my pageDef code :-
    <attributeValues IterBinding="InvoiceheaderView1Iterator" id="Suppostcode">
    <AttrNames>
    <Item Value="Suppostcode"/>
    </AttrNames>
    </attributeValues>
    <attributeValues IterBinding="InvoiceheaderView1Iterator" id="Suppvatid">
    <AttrNames>
    <Item Value="Suppvatid"/>
    </AttrNames>
    </attributeValues>
    <methodAction id="getSupplierIdfromDB" RequiresUpdateModel="true"
    Action="invokeMethod" MethodName="getSupplierIdfromDB"
    IsViewObjectMethod="false" DataControl="SupplierDetailImpl"
    InstanceName="SupplierDetailImpl.dataProvider"
    ReturnName="data.SupplierDetailImpl.methodResults.getSupplierIdfromDB_SupplierDetailImpl_dataProvider_getSupplierIdfromDB_result">
    <NamedData NDName="supplierpostcode"
    NDValue="#{bindings.Suppostcode.inputValue}"
    NDType="java.lang.String"/>
    <NamedData NDName="suppliervatid"
    NDValue="#{bindings.Suppvatid.inputValue}"
    NDType="java.lang.String"/>
    </methodAction>
    <list IterBinding="InvoiceheaderView1Iterator" id="supplierid"
    DTSupportsMRU="true" StaticList="false"
    ListIter="getSupplierIdfromDBIterator">
    <AttrNames>
    <Item Value="Suppid"/>
    </AttrNames>
    <ListAttrNames>
    <Item Value="supplierid"/>
    </ListAttrNames>
    <ListDisplayAttrNames>
    <Item Value="supplierid"/>
    </ListDisplayAttrNames>
    </list>
    </bindings>
    And i have a button on the page called as "Clear DropDown".Now on click of Clear DropDown button  i need to clear the dropdown list and need to set a new value in the SupplierId selectonechoice.For the testing purpose it can be a static value like "Shah".
    I am trying to do like this but no help ..
    public String clearDropDown() {
    ValueExpression suppid1 = null;
    String id = "Shah";
    suppid1 =
    elFactory.createValueExpression(elContext, "#{bindings.supplierid.attributeValue}",
    Object.class);
    suppid1.setValue(elContext,id);
    AdfFacesContext.getCurrentInstance().addPartialTarget(suppid);
    AdfFacesContext.getCurrentInstance().addPartialTarget(suppiditems);
    return null;
    Please suggest!!!
    Regards,
    Shah

    While setting the value, it is giving me this warning in the logs :-
    *<FacesCtrlListBinding> <getInputValue> ADFv: Could not find selected item matching value Shah of type: java.lang.String in the list-of-values*.
    I know that the Shah is not present in the List but how do i clear the list and set the New Value which is "Shah".
    Please Suggest!!
    Regards,
    Shah

  • SelectOneChoice value needed for find-method to refresh table

    I would like to implement a filter that will filter the dataset, resultset returned by my adf-table.
    The user has to select a value in the dropdown-list and after he has made a selection the table has to be refreshed using the value of the dropdown as a parameter-value for the find-method.
    I'm using a partialtrigger to raise the refresh-event on my table, autosubmit on my dropdown and partialtrigger-attribute on my table. Now I want to pass the value of the selectOneChoice to the key-value pair used for the find-method in my pageDefinition-file.
    What's the best practice to add this parameter-value?

    Frank,
    We tried the ValueChangeListener already on the selectOneChoice-component, but the listener doesn't get fired when you choose a new value in the selectOneChoice. Only the first time the method in our backing bean is accessed, and no other times.
    We are using datacontrols based on ejb 3.0 session beans as our persistence layer instead of BC and we would like to put the chosen value of the selectOneChoice-component in the parameter of our method binding. We should be able to it in the same manner as you've mentioned in the example, by accessing the paramMap.
    Thanks for the advise !

  • SelectOneChoice value getting reset

    Hi All,
    My page has 4 conditional selectOneChoice components.
    1.State
    2.City
    3.Area
    4.Zipcode
    I have partialtriggers for all components.When i select "State" my valueChangeListener gets called and values for "City" comes but the value for "State" selectOneChoice gets reset to "Unselected label".
    Please let me know the reason for value getting reset.
    Following is the code
    JSPX page
    <af:selectOneChoice id="compId328"
    value="#{bindings.State.inputValue}"
    label="#{messageBean['SS_UM_STATE']}"
    required="#{ !umRegistrationIdtypeChange.tdnRegPprFlag}"
    unselectedLabel="#{messageBean['SS_UM_STATE_SELECT']}"
    autoSubmit="true" inlineStyle="width: 125px"
    binding="#{umRegistrationIdtypeChange.stateSelecOneChoice}"
    valueChangeListener="#{umRegistrationIdtypeChange.chngCity}" >
    <af:selectItem label="AN" value="AN"/>
    <af:selectItem label="AP" value="AP"/>
    <af:selectItem label="AR" value="AR"/>
    <af:selectItem label="AS" value="AS"/>
    <af:selectItem label="UP" value="UP"/>
    <af:selectItem label="WB" value="WB"/>
    </af:selectOneChoice>
    <af:selectOneChoice id="compId333" partialTriggers="compId328"
    unselectedLabel="Select"
    inlineStyle="width: 125px"
    binding="#{umRegistrationIdtypeChange.cityselecOneChoice}"
    value="#{bindings.City.inputValue}"
    required="#{ !umRegistrationIdtypeChange.tdnRegPprFlag}"
    label="#{messageBean['SS_UM_CITY']}"
    autoSubmit="true"
    valueChangeListener="#{umRegistrationIdtypeChange.chngArea}">
    <f:selectItems value="#{umRegistrationIdtypeChange.returnCityList}"/>
    </af:selectOneChoice>
    <af:selectOneChoice id="compId334"
    partialTriggers="compId333 compId328"
    inlineStyle="width: 125px"
    required="#{ !umRegistrationIdtypeChange.tdnRegPprFlag}"
    value="#{bindings.StreetAddress3.inputValue}"
    autoSubmit="true" unselectedLabel="Select"
    binding="#{umRegistrationIdtypeChange.cityareaSelecOneChoice}"
    label="#{messageBean['SS_UM_STREET_ADDR3']}"
    valueChangeListener="#{umRegistrationIdtypeChange.chngPincode}">
    value="#{bindings.StreetAddress3.inputValue}"-->
    <f:selectItems value="#{umRegistrationIdtypeChange.returnAreaList}"/>
    </af:selectOneChoice>
    <af:selectOneChoice id="compId335"
    partialTriggers="compId334 compId333 compId328"
    inlineStyle="width: 125px"
    value="#{bindings.PostalCode.inputValue}"
    autoSubmit="true"
    required="#{ !umRegistrationIdtypeChange.tdnRegPprFlag}"
    unselectedLabel="Select"
    label="#{messageBean['SS_UM_ZIP_CODE']}"
    binding="#{umRegistrationIdtypeChange.postalcodeSelecOneChoice}"
    valueChangeListener="#{umRegistrationIdtypeChange.chngPostalCode}">
    <f:selectItems value="#{umRegistrationIdtypeChange.returnPincodeList}"/>
    </af:selectOneChoice>
    <af:inputText id="compId320"
    binding="#{umRegistrationIdtypeChange.houseNoInputText}"
    label="#{messageBean['TDN_UM_STREET_ADDR1']}"
    inlineStyle="width: 125px" maximumLength="100"
    required="true"
    requiredMessageDetail=" "
    value="#{bindings.StreetAddress.inputValue}"/>
    <af:inputText id="compId323"
    binding="#{umRegistrationIdtypeChange.street_addressInputText}"
    label="#{messageBean['TDN_UM_STREET_ADDR2']}"
    maximumLength="150" inlineStyle="width: 125px"
    rendered="true"
    required="true"
    requiredMessageDetail=" "
    value="#{bindings.StreetAddress2.inputValue}"/>
    Code in Bean
    public List<SelectItem> chngCity(ValueChangeEvent valueChangeEvent) {
    log.info("Call the chngCity method");
    returnCityList = new ArrayList<SelectItem>();
    String state = valueChangeEvent.getNewValue().toString();
    if (state != null) {
    List<Object> returnPickList = RegAMImpl.getCity(state);
    for (Object obj: returnPickList) {
    SelectItem si = new SelectItem();
    String eDistValues = obj.toString();
    si.setLabel(new String(eDistValues));
    si.setValue(new String(eDistValues));
    returnCityList.add(si);
    return returnCityList;
    public List<SelectItem> chngArea(ValueChangeEvent valueChangeEvent) {
    log.info("Call the chngArea method");
    returnAreaList = new ArrayList<SelectItem>();
    String city = valueChangeEvent.getNewValue().toString();
    if (city != null) {
    List<Object> returnPickList = RegAMImpl.getArea(city);
    for (Object obj: returnPickList) {
    SelectItem si = new SelectItem();
    String eDistValues = obj.toString();
    si.setLabel(new String(eDistValues));
    si.setValue(new String(eDistValues));
    returnAreaList.add(si);
    return returnAreaList;
    public List<SelectItem> chngPincode(ValueChangeEvent valueChangeEvent) {
    log.info("Call the chngPincode method");
    returnPincodeList = new ArrayList<SelectItem>();
    String area = valueChangeEvent.getNewValue().toString();
    if (area != null) {
    List<Object> returnPickList = RegAMImpl.getPincode(area);
    for (Object obj: returnPickList) {
    SelectItem si = new SelectItem();
    String eDistValues = obj.toString();
    si.setLabel(new String(eDistValues));
    si.setValue(new String(eDistValues));
    returnPincodeList.add(si);
    return returnPincodeList;
    public void chngPostalCode(ValueChangeEvent valueChangeEvent) {
    String pincode = valueChangeEvent.getNewValue().toString();
    UMPostalCodeTypeVOImpl pincodeVO = RegAMImpl.getUMPostalCodeTypeVO1();
    ViewCriteria vc = pincodeVO.createViewCriteria();
    ViewCriteriaRow vcr = vc.createViewCriteriaRow();
    vcr.setAttribute("ParentName", pincode);
    vc.insertElementAt(vcr, 0);
    pincodeVO.applyViewCriteria(vc);
    In pagedef i have also added RefreshCondition="{adfFacesContext.postback==true}" for iterators of VO's binded to selectOneChoice
    <iterator id="ContactAddressVO1Iterator" RangeSize="-1"
    Binds="Root.RegistrationAM1.ContactAddressVO1"
    DataControl="SessionAMDataControl" RefreshCondition="{adfFacesContext.postback==true}"/>
    <iterator id="RegStateTypeVO1Iterator" RangeSize="-1" RefreshCondition="{adfFacesContext.postback==true}"
    Binds="Root.RegistrationAM1.RegStateTypeVO1"
    DataControl="SessionAMDataControl"/>
    <iterator id="UMCityTypeVO1Iterator" RangeSize="-1" RefreshCondition="{adfFacesContext.postback==true}"
    Binds="Root.RegistrationAM1.UMCityTypeVO1"
    DataControl="SessionAMDataControl"/>
    <iterator id="UMCityAreaTypeVO1Iterator" RangeSize="-1" RefreshCondition="{adfFacesContext.postback==true}"
    Binds="Root.RegistrationAM1.UMCityAreaTypeVO1"
    DataControl="SessionAMDataControl"/>
    <iterator id="UMPostalCodeTypeVO1Iterator" RangeSize="-1" RefreshCondition="{adfFacesContext.postback==true}"
    Binds="Root.RegistrationAM1.UMPostalCodeTypeVO1"
    DataControl="SessionAMDataControl"/>
    Regards,
    Himanshu

    Please read the FAQ http://forums.oracle.com/forums/help.jspa and format your code, as it is unreadable.
    Next you need to supply more information about your environment like jdev version and technology stack you are using.
    Timo

  • Af:selectOneChoice value not disply in edit mode

    Helo Team,
    I have the following functionality..
    i have one Table.. & one Add button when i click on the add button one popoup will open i enter the data when i say ok then data will show in table & in table when i click the particular row..& click edit button & othe popup will open with edit mode all field which i entered previously are disply in edit mode...But only the value of Af:selectOneChoce value not disply in that componant ...
    How can i solve this problem ?

    Hi,
    How ur LOV(ie.SelectOneChoice) is attached to the field from a viewObject.. Is it attached through a viewAccessor?
    I think ur update page is a separate page having a form layout and if so please drag and drop the selectone choice field(ie.attribute has LOV entry) from respective
    viewObject shown in the datacontrol. this will create a LOV entry in ur pagedef file and try the same.... :)
    regards,
    Suganth.G

  • SelectOneChoice values get repeated

    I have some dependant drop down lists. This works pretty much fine (after several workarounds for other problems), except that I get strange behaviour where the data in the LOV gets repeated sometimes. It's reproducible but not by following any particular sequence of events that I can see.
    Say I had a SelectOneChoice with:
    1. Oracle
    2. Microsoft
    3. Sun
    Then, if I play with it for a bit, just selecting different values all over the place, eventually the list will contain:
    1. Oracle
    2. Microsoft
    3. Sun
    1. Oracle
    2. Microsoft
    3. Sun
    And sometimes that will go on and on, repeated many times.
    Now, is this a glitch with ADF, or should I be refreshing the iterator, and where/when should I do that?
    many thanks
    ~R

    Frank,
    Haven't had a chance to do that, but I know how to reproduce it now. Please see post:
    Page Def - where is the data coming from?

  • SelectOneChoice value to ManagedBean

    I have managed bean Person and want to set Country and City of Person. (countryFindAll and cityFindAll bindings are ready and work)
    I drag and drop countryFindAll then add SelectOneChoice. It generates the code as bindings.person.country I change the value of selectonechoice with #{PersonMBean.person.country.id}. (I can not return Country Object from countryFindAll binding Iterator).
    Instead of passing the id value of selected country, it passes index of Country. I tried valuePassThru but it does not work.
    2nd Question, City selectonechoice can not be updated when Country changes, even I added autoSubmit & partialTriggers to City and invoke action in bindings it does not work. Is there any tutorial for doing this with 11g ? (I found 10g tutorials and there are some differences like invokeAction with parameters etc.)

    you can get the id from valueChangeEvent like below. Regarding your 2nd question, set the attibute's updateable to always. Check here too http://www.oracle.com/technology/products/jdev/tips/mills/listvalue/listbindingvalue.html
        public void selectOneChoice1_valueChangeListener(ValueChangeEvent eve) {
            DCIteratorBinding  listIter = getBindingsForDCB().findIteratorBinding("yourViewObjIterator");                 
            int curIndex = (Integer)eve.getNewValue();
            Row datRow = listIter.getRowAtRangeIndex(curIndex);
            String id = (String)datRow.getAttribute("id"); 
            if (id != null){
        private  BindingContainer  bindings;
        public BindingContainer getBindings() {
            return this.bindings;
        public void setBindings(BindingContainer bindings) {
            this.bindings = bindings;
        public DCBindingContainer getBindingsForDCB() {
            if (this.bindings == null) {
                FacesContext fc = FacesContext.getCurrentInstance();
                this.bindings =(DCBindingContainer)fc.getApplication().evaluateExpressionGet(fc,"#{bindings}",DCBindingContainer.class);
            return (DCBindingContainer)this.bindings;
        }Edited by: puthanampatti on Oct 11, 2009 1:58 PM

  • Saving and passing SelectOneChoice Values for af: table population

    Hey yall.
    *First things first... I am using the EJB as opposed to ADF BC so any examples involving VO's would not help me at this point and that's pretty much all I have been able to find online when searching for help.  I am using JDev version 10.1.3.1.
    Im having some trouble trying to figure out how to program my command button to return a table using the values acquired from a set of 3 dynamic LOV's. In detail, this is what I'm trying to do but can't get it to work no matter what I do:
    1. I have a page where the user must select an option from each drop down list (there are 3 in all). The 2nd list depends on the 1st and the 3rd list depends on the 1st and 2nd. That part is working fine.
    2. Once all selections are made, the user must then click on execute (my command button on page) to then be taken to another page with a table populated using the values selected in the previous page. The table was created using a method from the data control palette that contains the named queries needed to return results in the table.
    3. My problem is figuring out how to wire the execute button to do the tasks mention in #2 above.
    Any suggestions? Ideas? Help?
    Greatly appreciative... Thanks.

    Hi,
    you can do this from the UI using createWithParams
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    Or by overriding the doDML on the parent EO so you can use an association to update the child records. And of course you could use view links similar. However, the update is recognized on the entity level. And finally, another option - if the tables are not loaded together in an application, is to use a database trigger
    Frank

  • Null Value in af:SelectOneChoice

    HI,
    I want to fetch value from a selectone choice,in backing bean.
    following is my binding.
    <af:selectOneChoice value="#{bindings.ExcelVOCode.inputValue}"
    label="#{bindings.ExcelVOCode.label}"
    validator="#{FileProcessor.selectOneChoice_validator}"
    id="excelTypeList" autoSubmit="true" valuePassThru="true"
    immediate="true"
    binding="#{FileProcessor.excelTypeList}">
    <f:selectItems value="#{bindings.ExcelVOCode.items}" id="selectItems1"
    binding="#{FileProcessor.selectItems1}"/>
    </af:selectOneChoice>
    And i have tried following method to get the values.
    1
    CoreSelectOneChoice exe=getexcelTypeList();
    System.out.println("Id"+exe.getValue().toString());
    2 FacesContext fc = FacesContext.getCurrentInstance();
    ValueBinding vb = fc.getApplication().createValueBinding("#{bindings.ExcelVOCode.inputValue}");
    System.out.println("Value"+vb.getValue(fc));
    But each of these method returns me null,
    Following is my page defination.
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="10.1.3.39.81" id="FileUploadPageDef"
    Package="xml.pageDefs">
    <parameters/>
    <executables>
    <iterator id="ExcelVOIterator" RangeSize="10" Binds="ExcelVO"
    DataControl="AppModuleDataControl"/>
    <iterator id="ExcelVO2Iterator" RangeSize="-1" Binds="ExcelVO2"
    DataControl="AppModuleDataControl"/>
    </executables>
    <bindings>
    <list id="ExcelVOCode" IterBinding="ExcelVOIterator" StaticList="false"
    ListOperMode="0" ListIter="ExcelVO2Iterator">
    <AttrNames>
    <Item Value="Code"/>
    </AttrNames>
    <ListAttrNames>
    <Item Value="Code"/>
    </ListAttrNames>
    <ListDisplayAttrNames>
    <Item Value="Name"/>
    </ListDisplayAttrNames>
    </list>
    </bindings>
    </pageDefinition>
    Please help me with it,
    Thanks

    Hi,
    Any how i was finally able to get the value by implementing somthing like this in the jsp
    <af:selectOneChoice value="#{bindings.ExcelVOCode.inputValue}"
    label="#{bindings.ExcelVOCode.label}"
    id="excelTypeList" autoSubmit="true" valuePassThru="true"
    immediate="false"
    binding="#{FileProcessor.excelTypeList}"
    simple="true" required="false"
    partialTriggers="excelTypeList">
    <af:forEach items="#{bindings.ExcelVO.rangeSet}" var="item">
    <af:selectItem value="#{item.Code}" label="#{item.Name}"
    binding="#{FileProcessor.selectItem}"/>
    </af:forEach>
    </af:selectOneChoice>
    and this in the backing bean.
    CoreSelectItem seq=getSelectItem();
    System.out.println("Item"+seq.getLabel());
    But the problem is when i attach a binding to Selectitem,it doesn't show me all the values in the drop down it only shows the last value in the table ,i.e the drop down have a single entry.
    Please provide some indicator.
    Thanks

Maybe you are looking for