I’ve been thinking about the idea of a more advanced structure field with unlimited nesting and inline data. The more I think about it, the more I feel that it’s an impossible task to solve.
Let’s say I would try to build a new advanced structure field as a plugin…
Nesting
If I implemented unlimited nesting I would get all kinds of problems, especially with the dom.
<div class="field">
<div class="field">
<div class="field">
</div>
</div>
</div>
Javascript and css
First of all, nested fields in the dom could possibly mess up jQuery dom nodes. Then css could be messed up as well. It could probably be solved in a good way for built in fields, but my guess is that many of the plugin fields will stop working.
Inline content
Now a modal is used to separate the structure field from the page form. To use inline content will create new problems.
Generate subfields with javascript?
One problem is that it needs to generate the data to a hidden field, probably rely on javascript. If something goes wrong many subfields in the structure field will not be saved.
Validation
Another problem is form validation. If we generate everything with javascript to a hidden field, how could it take validation into account? Maybe a custom javascript validation is required. That would require more work.
It seems like this solution is less reliable than a modal.
Summery
To have everything in a single form, including nesting does not seems to be as reliable as a modal. Some possible problems could be:
- jQuery dom nodes
- Css
- Form validation
- Javascript data generation
- Plugin fields compability
Do you think it’s possible to make an awesome structure field with nesting and inline data?
- Yes, tell us your thoughts
- No