Announcement Announcement Module
Collapse
No announcement yet.
validatePage on a dirtyBack Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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...
    Code:
    if &#40;!&#40;&#40;this.allowDirtyBack&#41; && &#40;targetPage < currentPage&#41;&#41;&#41; &#123;
      validatePage&#40;command, errors, currentPage, false&#41;;
    &#125;
    and then perhaps do the same thing for dirtyForward, though I can't think of the use cases for dirty forward.
Working...
X