Support the ongoing development of Laravel.io →
Views Blade Forms

We have a form that is built on the client side using an HTML template and Javascript, As information is entered, javascript uses the template to "grow" the form, along with the creation of dynamic tabs on top of the form that enable switching views of different parts of the form. As such, it is not so simple as a replication of a dom block. Information from the form is sent to the server as a JSON object.

As a convenience for the users that are coming back to the site, we wish to provide a way to re-generate this form. We can email them a unique URL with the encoded JSON object, and are now looking at different strategies to regenerate the actual page.. so far the options we see are:

  1. on server-side, use the "DOMdocument" builtin PHP DOM engine to create the form based upon the JSON object and the page template that we have on the server

  2. on server side, use BLADE/PHP to generate a view given the JSON object

  3. on the client side, build a basic "playback" engine that would take the JSON and attempt to use the existing javascript functions to rebuild the resulting dom. ( this is interesting since then the page construction logic is not replicated on server )

  4. send a HTML version of the fully-loaded form (not just the form data ) to the server, store in some form of short-term database or file that gets cleared after some period of time, and enable a re-load using a hash ID that the user can reference when re-loading the page.

I've noticed that there is no DOM manipulation library that give the power of Jquery in PHP has really become standardized. Although Symphony provides a DOM traversal library, it is expressly stated that it is no good for "manipulation" There must be something wrong with that approach??

Anyway, what do folks typically do in this circumstance?

thanks!

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

sdwarwick sdwarwick Joined 21 Jul 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.