2 Replies Latest reply: Sep 7, 2013 3:09 PM by Lars Hansen RSS

    Reset af:inputText values and clear cache

    Lars Hansen

      Greeting everyone!

      I use JDev Version 11.1.2.3.0

       

      I have three af:inputText components, all pointin to persistent attributes from one VO. One of these fields gets it's value calculated (in a managed bean) from the others two values. This is done on value change of these two fields. The problem is when i reset these other two fields (meaning, when i delete the content inside of them). The value on the third field does not to change at first. From the controls i've done, it seems that it keeps a value in a cache. So when i clear the first field, the value of the third field remains the same, and when i clear the value from the second field too, then the third field gets the value cleared from the second field.

      I know this might be a bit confusing so here is the basic code snippet i've tried:

       

       

          public void getTotalContractInfo(ValueChangeEvent valueChangeEvent) {

              System.out.println("A value is changing!");

              if (tvshContractInfo.getValue()!= null && it14.getValue()!= null) {

                 BigDecimal x = new BigDecimal(tvshContractInfo.getValue().toString());

                  BigDecimal y= new BigDecimal(it14.getValue().toString());

                  BigDecimal i = new BigDecimal(100);

                  BigDecimal m = (y.multiply(x)).divide(i);

                  totalContractInfo.setValue(y.add(m));

               

              }

              else if (tvshContractInfo.getValue()== null && it14.getValue()!= null){

              totalContractInfo.setValue(Integer.parseInt(it14.getValue().toString()));

              }

       

              else if (it14.getValue()== null ){

              it14.resetValue();

                  totalContractInfo.resetValue();

              }

       

      Any ideas what is happening? I've tried several techniques to refresh the components or clear the binding cache, but none of them seems to work.

       

      Thank you in advance!