Skip Navigation
Docs

Under the hood

This page explains the inner workings of DreamForm. Some of this stuff might be useful to you, if you're extending DreamForm with custom guards, fields or actions. It's also not complete. Let me know if there's anything missing that might be useful to know.

Lifecycle of a form submission

  1. The form page is resolved, e.g. from a field.
  2. The form template accesses the submission from the session data, if available.
  3. The form is rendered in the template, either using the default snippet or a custom one.
  4. The user fills out the form and submits it.
  5. The submission page is created (virtually).
  6. dreamform.submit:before hook is called.
  7. The guards are checked.
  8. The form fields are validated.
  9. If the form validation was successful & the form is at the last stage, the form actions are executed.
  10. dreamform.submit:after hook is called - even if the form submission is uncomplete (multi-step form).
  11. The form submission is saved as page if the submission has been successful so far.
  12. The fields afterSubmit methods are called (used for file uploads).
  13. The form submission is saved as session data.