0 Replies Latest reply on Jun 3, 2014 11:34 AM by Brent Harlow

    Avoiding validation when immediate components used

    Brent Harlow

      Dear all,


      I'm using JDeveloper 11.1.2 and JHeadstart


      I've had this issue for a long time and seem to have tried every single suggestion on the internet about how to fix it - unfortunately none of the suggested solutions has worked for me. 


      The problem is avoiding mandatory validation within a wizard when the user clicks on the cancel button - when the mandatory component has autoSubmit and immediate set to true as it is used to conditionally render other fields on the same page.


      I've tried using javscript like ADF Practice: How to avoid validation of immediate inputs, I've tried using renderResponse like ADF Practice: Understanding the JSF Immediate Attribute but both seem to have no effect (I know the JHeadstart RollbackBean.execute already uses JsfUtils.jumpToRenderResponseIfNeeded but perhaps the timing of it is not in the right place ?


      The code for my mandatory, autosubmit dropdown list


                              <af:selectOneChoice id="SubjectVisitWizardWithdrawEarlyv2" value="#{bindings.SubjectVisitWizardWithdrawEarlyv2.inputValue}"
                                                  label="#{nls['SUBJECTVISITWIZARD_WITHDRAWEARLYV2']}" required="true"
                                                  rendered="#{bindings.SubjectVisitWizardCurrentVisit.inputValue=='2' and (bindings.SubjectVisitWizardHardVisitWindow.inputValue=='OK' or jhsUser.userRoleShort=='HMD') and bindings.SubjectVisitWizardNumNrsRecorded.inputValue>1}"
                                                  valueChangeListener="#{ValidateBean.toggle}" autoSubmit="true" immediate="true"


      The code for the cancel button


                          <af:commandButton textAndAccessKey="#{nls['CANCEL']}" immediate="true" partialSubmit="true"
                                            rendered="#{!pageFlowScope.hideCancelButton}" actionListener="#{jhsRollback.execute}"
                                            action="SubjectVisitsDeepLink" id="SubjectVisitWizardCancelButton">


      public class ValidateBean {
          private static final ADFLogger sLog = ADFLogger.createADFLogger(ValidateBean.class);
          public void toggle (ValueChangeEvent vce) {
             sLog.info("*** toggle");
              // This is to avoid validation errors on the rest of the page if they select a value here
              // before completing mandatory fields 


      It doesn't make any sense to the users to have to complete fields simply to cancel the transaction !  Can someone please help ?? How has this problem being avoided in other JHeadstart projects ?


      Would really appreciate any input/help with this problem.