Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to reset a lov value(which is a VO) on click of a button

user8696578May 18 2015 — edited May 19 2015

Hi ADF Experts,

JDEv version

I have two VO's and both the VO's are dragged as a selectOneChoice as below

VO1

select FIRST_NAME from employees where job_id = 'AD_VP'

VO2

select department_name from departments where location_id >1500

<af:selectOneChoice value="#{bindings.ViewObj1.inputValue}"

                            label="#{bindings.ViewObj1.label}"

                            binding="#{backingBeanScope.TestBean.lov1}"

                      autoSubmit="true"      shortDesc="#{bindings.ViewObj1.hints.tooltip}"

                        unselectedLabel="--Select--"    id="soc1">

          <f:selectItems value="#{bindings.ViewObj1.items}" id="si1"/>

        </af:selectOneChoice>

        <af:selectOneChoice value="#{bindings.ViewObj1_1.inputValue}"

                            label="#{bindings.ViewObj1_1.label}"

                   autoSubmit="true"         shortDesc="#{bindings.ViewObj1_1.hints.tooltip}"

                         unselectedLabel="--Select--"   id="soc2"

                            binding="#{backingBeanScope.TestBean.lov2}">

          <f:selectItems value="#{bindings.ViewObj1_1.items}" id="si2"/>

        </af:selectOneChoice>

There's a add button where I want to validate if user has selected any value. But the validation fails because it assumes the unselected label as index 0. Also it assumes the first selected index as index 0

I tried to print the values of unselected label and first selected index. It gives 0 in both case.

    System.out.println(lov1.getValue());
    System.out.println(lov2.getValue());
    lov1.setValue(-1);
    lov2.setValue(-1);
//    lov1.resetValue();
//    lov2.resetValue();
    AdfFacesContext.getCurrentInstance().addPartialTarget(lov1);
    AdfFacesContext.getCurrentInstance().addPartialTarget(lov2);

So, how to reset both values on click of Add button. DO I need to reexecute the query of both VO's?

Thanks,

Roy

This post has been answered by user8696578 on May 19 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 16 2015
Added on May 18 2015
4 comments
1,245 views