Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field image #210

Closed
mabilbao opened this issue Oct 27, 2016 · 2 comments
Closed

Field image #210

mabilbao opened this issue Oct 27, 2016 · 2 comments

Comments

@mabilbao
Copy link

Hey Guys!

I am starting to use Backpack CRUD and I have a problem for maintain the image fields when I use the laravel validation in a request.

For example:
I have two field:

  • name --> type: text
  • photo --> type: image

name is required but suppose that I only completed the photo and press save.
The form shows the error message ('name is required') but the field photo is empty.

Do you have some idea for fix this? For now, my only idea is extend edit.blade.php and add the validations by javascript only for this CRUD.

Thanks and the tool is very util!

@tabacitu
Copy link
Member

tabacitu commented Oct 28, 2016

Unfortunately there's no way to prefill the image (basically upload/upload_multiple) after refresh. It's a HTML5 limitation.

But what you CAN do, even though it's a little ugly, is add the html5 attribute "required" to it. That should run a html5 validation to it, before rhe form is submitted.

"attributes" => [
  "required" => "required"
]

On both name and image.

Does that work for you?

@OwenMelbz
Copy link
Contributor

Tidying up the place :) Feel free to re-open if you still need help

This was referenced Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants