grigoletti's avatar

Handling of dynamic form schemas

Hello everyone, in the community of particle physicists there is a web application called Elog that acts as an electronic logbook system where admins define the schema of an "Entry" and users can insert entries. This application is very old and there are some issues that I would like to address. So I would like to take the opportunity to learn Laravel by starting to make a simpler version of it.

What I think it is unique in the application is that admin users can write to a config file the schema of the logbook entries, indicating the fields and the conditional field logic required to fill in an entry.

The main features that I think are relevant for this particular applications are:

  • A way for admins to set the fields of the entries and render some fields based on conditions of other fields (for instance, render the field "sub system" based on the choice of the field "system").
  • A way for users to search along entries with a proper text or form search

I see a few issues that I am still trying to figure out:

  • The first is finding a consistent way to model a form from a config file. So far I have discovered json-schema and I found out that there are js libraries that render forms based on it. I don't know if there is any equivalent utility in Laravel or PHP world that does the same job

  • The other issue I had is the handling of the database. If using something like json schema my guess would be that I need to model an entity like "Entry" having an attribute schema represented as json and an attribute "data" represented as well as json. I can't think of other easy solutions avoiding json

  • Server side validation: I think that if I decide to use json-schema I should find a php validator or write one on my own for the backend

I would like your opinion on how one could accomplish this task with a framework like laravel and if you know of any solution already existing

0 likes
0 replies

Please or to participate in this conversation.