Announcement Announcement Module
No announcement yet.
validatePage on a dirtyBack Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • validatePage on a dirtyBack

    I've searched all over, but haven't found any posts or discussions on this topic so here goes...

    I am using AbstractWizardFormController for a four page "order entry" style wizard. I validate on each page and produce both field and global errors. Everything works great and this wizard class has allowed me to make very clean code.

    Except that I have a problem with dirtyBack. Scenario: you are on the “shipping address” page and you click back. validatePage() gets called for shipping page, then you get shown the “order entry” page, but it displays the global errors from the “shipping address” page. This is because I create and display global errors (for example, “Required Fields are missing, please correct them below”).

    How do I prevent validatePage() from getting called when you hit back?

    For that matter, I don’t see why validatePage() should be called at all when you hit back and dirtyBack = true.

    You could change line 413 of AbstractWizardFormController to something like...
    if &#40;!&#40;&#40;this.allowDirtyBack&#41; && &#40;targetPage < currentPage&#41;&#41;&#41; &#123;
      validatePage&#40;command, errors, currentPage, false&#41;;
    and then perhaps do the same thing for dirtyForward, though I can't think of the use cases for dirty forward.