Announcement Announcement Module
Collapse
No announcement yet.
Preventing AbstractWizardFormController from validating. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Preventing AbstractWizardFormController from validating.

    Hello there,
    I have been trying to find a way for preventing my implementation of AbstractWizardFormController from validating the currentPage when the target page is the same as the current. In this case the form is been submited to it self which in most cases is used to update some referenced data in the form. At this point there is no reason to validate the page as it is no exiting.
    The validatePage() methods do not include the request as parameter so I can not call getCurrentPage() nor getTargetPage() from whitin them.
    Has anyone run into this problem before? If so, how was it solved?
    As a last resource I could override processFormSubmision and prevent it from calling validatePage when this is the situation but I want to know if there is a simpler way to do it.

    Thanks.

    Erick.

  • #2
    I haven't run into this problem yet, therefor I'm not sure if my solution is what you need, but I think you can override

    Code:
    suppressValidation(HttpServletRequest request)
    Hope this helps. Could you let me know if it worked?

    Regards,
    Erik

    Comment


    • #3
      Actually, the AbstractWizardFormController does not call suppressValidation(), so that will not work.

      This is a problem with the current AbstractWizardFormController that is giving people some problems. See for instance http://]http://forum.springframework...ad.php?t=12659.

      I guess we can post this in a RFE in JIRA?

      Erwin
      Last edited by robyn; May 19th, 2006, 05:52 AM.

      Comment


      • #4
        As far as I can see, the AbstractFormController calls bindAndValidate() on BaseCommandController, after which the AbstractFormController calls processFormSubmission() on the AbstractWizardFormController().

        Note that bindAndValidate() on BaseCommandController calls suppressValidation().

        What am I missing?

        Regards,
        Erik

        Comment


        • #5
          In bindAndValidate() of BaseCommandController you have:

          Code:
          if (this.validators != null && isValidateOnBinding() && !suppressValidation(request)) {
          	for &#40;int i = 0; i < this.validators.length; i++&#41; &#123;
          		ValidationUtils.invokeValidator&#40;this.validators&#91;i&#93;, command, binder.getErrors&#40;&#41;&#41;;
          	&#125;
          &#125;
          And in the AbstractWizardFormController constructor you have:

          Code:
          // Never validate everything on binding ->
          // wizards validate individual pages.
          setValidateOnBinding&#40;false&#41;;
          So suppressValidation() is never called.

          The AbstractWizardFormController should really be checking "suppressValidation" before calling validatePage().

          Erwin

          Comment


          • #6
            suppresing validation in AbstractWizardForm Controller

            Thank you guys for your repliies.
            This problem I already solved. Not the cleanest way I believe but solved anyway.
            I had to set a field in my form to indicate that I was going back to the server for more information and not to move forward to the next page in the wizard.
            In the bindAndValidate I look for this parameter if the currentPage is the one that has it and if setted I then set a property in the command object and ask for it in the validation method.
            Kind of cumbersome but the fact that method processFormSubmision in AbstractWizardFormController is final, left no other choice, at least no one that I could think of.
            Cheers
            Erick.

            Comment

            Working...
            X