9 Replies Latest reply: Mar 22, 2013 5:47 AM by 966801 RSS

    clear select one choice on popup re launch

    966801
      i have a popup with input texts and select one choice components with popup delivery mode lazyUncached.
      i am launching popup programatically through binding on click of a command menu item.
      when user launched popup for second time, he sees the input entered on first time.
      how can popup soc can be cleared for second time.
      i am able to clear input texts using resetValue on binding, but this is not working on SOC.
      jdev 11 1 1 5
        • 1. Re: clear select one choice on popup re launch
          Timo Hahn
          The soc has a value property. This is set when you select something in the soc.
          So you have to clear the value given in the soc value property.

          Timo
          • 2. Re: clear select one choice on popup re launch
            966801
            i tried orderType.setValue(null) and JSFUtil.setExpressionValue("#{bindings.OrderType.inputValue}",null) and then a addPartialTarget before doing popup.show(hints) in the actionEvent from where i am launching popup but soc appears prepopulated with the value last selected
            • 3. Re: clear select one choice on popup re launch
              Timo Hahn
              Can you post the SOc tag?
              is "#{bindings.OrderType.inputValue}" pointing to the soc model list or is a variable from a different row or bean property?

              Timo
              • 4. Re: clear select one choice on popup re launch
                966801
                <af:selectOneChoice value="#{bindings.OrderType.inputValue}"
                label="#{viewcontrollerBundle.ORDER_TYPE}"
                shortDesc="#{viewcontrollerBundle.ORDER_TYPE}"
                id="soc1"
                showRequired="true" required="true"
                requiredMessageDetail="#{viewcontrollerBundle.PLEASE_CHOOSE_ORDER_TYPE}"
                binding="#{pageFlowScope.OrderBean.orderType}"
                partialTriggers="cb112 cmi1">
                <f:selectItems value="#{bindings.OrderType.items}"
                id="si6"/>
                </af:selectOneChoice>


                this is a Dynamic List binding

                i have set selection required for no selection item

                this binding displays data from a data control whose data is already displayed on page where this popup is present

                Edited by: 963798 on Mar 21, 2013 4:06 AM
                • 5. Re: clear select one choice on popup re launch
                  Timo Hahn
                  <af:selectOneChoice value="#{bindings.OrderType.inputValue}"
                  ...>
                  <f:selectItems value="#{bindings.OrderType.items}"
                  id="si6"/>
                  </af:selectOneChoice>
                  This is your problem. You are storing the value selected on the list itself. If you do this you can't undo it. You should store the value using a different attribute. You can e.g. create a variable in your pagedef and store the selected value in there. Then you can clear this variable and it should work.

                  To add a variable in the executable section of the bindings of the page.
                  1) open the bindings of the page
                  2) right click on the variables in the executables section and choose 'Insert Inside Variables'->'variable'
                  3) in the dialog set a name e.g. typeSelected with type java.lang.Integer
                  4) click the green '+' sign in the Bindings section, select AattributeValues, cklick OK
                  5) select 'variables' as datasource and 'typeSelected' as attribute
                  This will create a variable of type integer in the bindings of the page. This can be used to store the value of the soc component. For this select the soc in your page and in the property inspector add
                  #{bindings.typeSelected1.inputValue}
                  to the value property. This will transfer the selected value of the soc to the variable you created (don't forget to set autosubmit to true for the soc).

                  Now to reset the soc set the #{bindings.typeSelected1.inputValue} to null.

                  Timo
                  • 6. Re: clear select one choice on popup re launch
                    966801
                    i am doing JSFUtil.setExpressionValue("#{bindings.OrderType.inputValue}",null); and attributeBinding.setInputValue(null);
                    problem solved but is it fine getting there messages :

                    <SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "1" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc1]
                    <SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "1" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc12]
                    <SimpleSelectOneRenderer> <_getSelectedIndex> Could not find selected item matching value "1" in RichSelectOneChoice[UIXEditableFacesBeanImpl, id=soc13]
                    • 7. Re: clear select one choice on popup re launch
                      vikasadf
                      please use the following property of af:popup
                      resetEditableValues="whenCanceled"
                      • 8. Re: clear select one choice on popup re launch
                        966801
                        is this available in jdev 11 1 1 5. i could not find this.
                        • 9. Re: clear select one choice on popup re launch
                          966801
                          this approach does clear soc on popup launch but soc does not get set after user has selected them on popup. it breaks other code.