getgrav / getgrav/grav-plugin-admin
Cannot save page with media upload if validate.required: true is set
- Dominant language
- PHP
- Stars
- 377
- Forks
- 225
- Avg merge
- 11h 51m
- Merged PRs (30d)
- 4
Description
I am trying to create a blueprint which includes something like the following:
```yaml
header.image:
type: file
label: Select the event logo image
multiple: false
destination: 'event'
random_name: false
avoid_overwriting: false
limit: 1
filesize: 2
validate:
required: true
accept:
- image/*
```
However, if I have the `validate.required: true` component when I got to click the save button in the admin panel, nothing will happen. I only get a javascript error:
> An invalid form control with name='' is not focusable.
If I remove:
```yaml
validate:
required: true
```
Then the page will save, file uploads, etc.
I have tried changing and removing the various other parameters, but it seems to be that when I make it a required field I am unable to save.
What might be interfering and preventing me from making this work that I can set within `grav`? I believe this error is because it is failing to perform the client-side validation (?)
I also noted if I add:
```yaml
header.image:
type: file
label: Select the event logo image
name: 'event-image'
...
```
The name value (in this case `event-image`) does not appear anywhere in the HTML source on the admin page (I also tried with quoting the value for `name`)
Contributor guide
Assessment
This issue has not been assessed yet.