3 Replies Latest reply: Mar 19, 2013 10:01 AM by sei64 RSS

    Custom SkipValidation in a fragment pageDef

    sei64
      Hi,

      Jdeveloper 11.1.2.3

      Our application is based on dynamic tabs design pattern. ( [https://blogs.oracle.com/jheadstart/entry/core_adf11_uishell_with_dynamic|https://blogs.oracle.com/jheadstart/entry/core_adf11_uishell_with_dynamic] )
      We can change tab, even if it exist a non valid entity, but when we commit a tab (other open tab), ADF validates all entities of different tabs, not only the current tab.

      We try with SkipValidation=true or skipdataControl but we need entity level validation (like SkipValidation=false behaivor), not on the commit..

      We are trying to set skipValidation=false for the selected tab and true for the others. To do that, we are trying with skipValidation=custom and a custom BindingContainerValidator.

      The problem is that our custom validator is not executed when it is configured in a fragment's pageDefs

      public void validateBindingContainer(BindingContainer bindingContainer) {
      DynTabManager tabMng = (DynTabManager)JSFUtil.resolveExpression("#{viewScope.dynTabManager}");
      String currentPageDef = bindingContainer.getName();
      DynTab selectedTab = tabMng.getSelectedTab();
      String selectedPageDef = (String)selectedTab.getParameters().get("pi_bindings"); //
      if (currentPageDef.equals(selectedPageDef)) {
      //execute validation
      ((DCBindingContainer)bindingContainer).setSkipValidation(false);
      } else {
      //avoid validation
      ((DCBindingContainer)bindingContainer).setSkipValidation(true);
      }
      }


      In a Bounded Task flow template :
      <managed-bean id="__16">
      <managed-bean-name>customPageDefValidator</managed-bean-name>
      <managed-bean-class>CustomPageDefValidator</managed-bean-class>
      <managed-bean-scope>pageFlow</managed-bean-scope>
      </managed-bean>


      In a fragment pageDefs :
      SkipValidation="custom" CustomValidator="#{pageFlowScope.customPageDefValidator}"


      We already try with different scopes but our custom validator is not executed, otherwise is executed when is configurated in a page pageDef (not fragment).


      Any suggestion or explanation is apreciated.
        • 1. Re: Custom SkipValidation in a fragment pageDef
          sei64
          Hi,

          somebody has any suggestion to have a validation only in a current open tab?
          skipvalidation=true is not a desirable behaviour, we need a validation when change row ... like skipvalidation=false


          thanks in advance
          • 2. Re: Custom SkipValidation in a fragment pageDef
            Frank Nimphius-Oracle
            Hi,

            have a look at this

            http://www.oracle.com/technetwork/developer-tools/adf/learnmore/40-ppr-subform-169182.pdf

            the sub form is a single page equivalent to your multi pageDef use case. Define a condition that can be accessed through a task flow property and have this determining the validation checking

            Frank
            • 3. Re: Custom SkipValidation in a fragment pageDef
              sei64
              Hi Frank, and thanks for your response.

              We already knew the document you post. However, the behaviour is not exactly what we want.
              In these exemple, i think once the subform is submitted the validations won't be skipped when you submit the other subform.

              What we expect is a SkipValidation=false bahaviour only for the actif tab.

              We done different test :
              +(we have only one page def per Bounded task flow)+

              Test 1 :

              -  SkipValidation=false  in a fragment pagedef  :
              Entity level validations are executed.
              All datacontrols validations of a page are executed.
              And we see the other tabs validations errors. It is not the desirable behaviour for us.

              Test 2:

              - SkipValidation=true   in a fragment pagedef  :
              Entity level validations are not executed when we change row ...
              Validations of datacontrols are executed at the commit.
              The other datacontrols validations are not executed.
                   
                   Unfortunately, it is not the desirable behaviour for us because we need a validation when we change row ... entity level validation.

              Test 3 :

              - SkipValidation=skipDatacontrol   in a fragment pagedef  :
              The same behaviour like test 2.
                        
                        Why Entity levels validations are executed at the commit, not when we change a row. Is that normal?
                        The documentation said that with this value of skipValidation, the framework will execute validation
                        rules defined at attribute level or at entity object level for rows which are modified in the current transaction.
                        
                        We dont understand the difference between SkipValidation=true and SkipValidation=skipDatacontrol
                        

              Test 4 :

              - SkipValidation=custom  in a fragment pagedef  :
              The custom validator in configured like managedBean in the adfc-config.xml with request Scope
              The custom validator is not executed, but te behaivour is like test 2 (skipvalidator=true)

              Test 5 :

              - SkipValidation=custom in a main page PageDefs :

              The custom validator is executed, but te behaivour is like test 2 (skipvalidator=true)
                   
                   In these case we try to set the property SkipValidation of the pageDefs of tabs, but is not working.

                   
              public void validateBindingContainer(BindingContainer bindingContainer) {
              DynTabManager tabMng = (DynTabManager)JSFUtil.resolveExpression("#{viewScope.dynTabManager}");
              String selectedTabId = tabMng.getSelectedTabId();

              for (DynTab tab : tabMng.getTabList()) {           
              String tabPageDef = (String)tab.getParameters().get("pi_bindings");
              DCBindingContainer binding = (DCBindingContainer) JSFUtil.resolveExpression("#{data."+tabPageDef+"}");

              if (tab.getId().equals(selectedTabId)) {
              // Normal validation in current TAB
              binding.setSkipValidation(false);
              } else {
              //avoid validation other tabs
              binding.setSkipValidation(true);
              }
              }
              return;
              }
                   
                   

              Thanks for your help.