getgrav / getgrav/grav-plugin-form
Allow to skip field rendering still allowing its server-side processing
- Dominant language
- PHP
- Stars
- 64
- Forks
- 80
- Avg merge
- 10h 13m
- Merged PRs (30d)
- 9
Description
A custom admin-field I developped is dynamically creating subfields on the fly.
For example:
```yaml
header.form.field_selection:
type: my-custom-type
fields:
firstname:
content: First name
```
would submit `data[header][form][firstname]` **and** `data[header][form][_is_required][firstName] = 0 or 1`
Since `_is_required` is not `known` to the blueprint, it ends-up in `blueprint.extra`, thus creating a hidden element under `[data][_json]` which, sadly, *always* take-over my submitted values
=> data is not saved.
In order to avoid that, I added a:
```yaml
header.form._is_required:
type: hidden
```
to my form.
The problem is that with such a hidden field, the POST submission looks like:
```
data[header][form][_required] = ""
data[header][form][_required][firstname] = 1
```
=> data is not saved because the array structure is disregarded.
Contributor guide
No contributing guide indexed for this repository
Research direction
No file or test is named. Start by tracing the custom admin-field and hidden-field submission behavior described in the issue, including blueprint.extra and the server-side POST processing. Done means dynamically created subfields can be processed without a rendered hidden field overriding the submitted array values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100