2 Replies Latest reply: Sep 21, 2012 7:53 AM by Chandruhere4u RSS

    Mapping the value based on the seletion of somee object

    Chandruhere4u
      Hi All,

      I am a newbie to ADF, just learning couple of things.

      I wanted to do something like this.

      I have 2 objects in a JSPX page,
      1: a dropdown with a list of codes.
      2: A textbox.

      I need to update the description of the code I will be selecting from the dropdown of 1st object to the 2nd textbox.

      I have created a managed bean for ValueChangeListener, and getting extracting the descrition for the code, I am selecting.
      But I am not getting how to map this value to the second textbox.

      Any help is highly appreciated.

      Thanks,
      Chandru
        • 1. Re: Mapping the value based on the seletion of somee object
          prateekazam
          you bind the second component in to backing bean and in value change listener of the select one choice just try to set the value .for example

          secondBindingName.setValue("pass the selected value").


          Thanks
          Prateek
          • 2. Re: Mapping the value based on the seletion of somee object
            Chandruhere4u
            Hi Prateek,

            Thanks for your reply.
            I tried to call the second validate method from the first selectOneChoice, valueChangeListener class.
            But the method is expecting the FacesContext object, and UComponentObject, Object object#I dont know what to pass, as I dont have the objects inside this valueChangeListener method.

            first SelectoneChoice in JSPX is:
            <af:selectOneChoice id="dc_BusinessCodeID1" label="#{masResources.CAPCCODE}" required="#{attrs.required}"
            valueChangeListener="#{BusinessCodeListnerBean.BusinessCodeDesc_Extractor}" autoSubmit="true"/>

            Second InputText is:
            <af:inputText label="#{masResources.MERCHANT_INDUSTRY}"
            maximumLength="9999"
            id="inputText3"
            value="#{attrs.merchantIndustryBinding.inputValue}"
            rows="1" readOnly="#{attrs.reviewMode}"
                           required="#{attrs.required}"
            validator="#{BusinessCodeListnerBean.inputText3_validator}"/>

            I have created 2 methods in the same bean class.

            I have the selected value from the valueChangeListener.

            valueChangeListener methos.
            public void BusinessCodeDesc_Extractor(ValueChangeEvent valueChangeEvent) throws Exception{
            }

            Validator method for InputText
            public void inputText3_validator(FacesContext facesContext,
            UIComponent uIComponent, Object object) {
            // Add event code here...
            UIViewRoot root = facesContext.getCurrentInstance().getViewRoot();
            inputText = (RichInputText)root.findComponent("inputText3");
            inputText.setValue(mandatoryField);
            }

            I dont know, am I doing something wrong here, or I dont know how can I move further.

            Please let me know, hoe can I call the second method from first, or is there a way to set the value?

            Thanks,
            Chandru