0
 Followers
2
 Likes

Refactor WebPage.Submit into WebPage.Forms.Submit with each Form having isolated Validate & Save actions

Community Forge
On our radar

The existing OS infrastructure around form validation is pretty clear with a single form.  It becomes less clear on complicated UIs that contain WebBlocks that have inputs that need validation.  The current OS infrastructure requires that each WebBlock that has an input that should be included in form validation be wrapped in its own form component on the parent web page:

Web Page

       Form_ForWebBlock1

              WebBlock1

                     Inputs

       Form_ForWebBlock2

              WebBlock2

                     Inputs

       Form_ForLocalInputs

              Inputs

Submit Button


With such a layout, OS validates all input controls contained within the Form components hosted directly on the WebPage.  If a WebBlock is not contained it own Form, even if the WebBlock contains a Form internally, the WebPage Submit will not validate the input controls contained within that WebBlock.  Thus the WebPage.OnSaveAction needs to understand the business logic any extra validation per form in addition to the any form save logic.

Recommendations

  1. Refactor WebPage Submit behavior into a Validate and Submit actions/events.
  2. Add Validate action to the Form Component (similar to item 1 above)
  3. Refactor current internal WebPage Validate function into a to delegates to Form components for validation (incorporating items 1 & 2 above).
  4. Refactor current OS Form component to have an optional Save action where the save action can be optional called by any Parent WebPage or WebBlock Submit action such that Save business logic can be encapsulated at the form level.
Created on 11 Oct 2017
Comments (2)

Hello Erik. Are you talking about having distinct <form> elements on the HTML? Or just having a way to group inputs for validation?

Also, are you interested only in grouping inputs for client-side validations, or also server-side validations?

12 Oct 2017

That only works if people put everything into the form itself, which often does not happen for a number of reasons.

J.Ja

views
119
Followers
0