Voyager: Image field in edit mode still asking for image as a 'required' field

Created on 6 Sep 2018  路  6Comments  路  Source: the-control-group/voyager

Version information

  • Laravel: v5.6.28
  • Voyager: v1.1.3
  • PHP: 7.1.11
  • Database: 10.1.28-MariaDB

Description

Image field in edit mode still asking for image as a 'required' field.

Steps To Reproduce

1.Making image fields as 'required' using below JSON in the BREAD section
{ "validation": { "rule": "required" } }
works well in add mode.

image_bread

  1. But in edit mode, it is still asking for an image.

image_bread-edit

Expected behavior

The image already exists and should therefore not get the 'The Image field is required.' prompt on edit

Most helpful comment

@alaamebrahim It's not really a solution. Because you can delete image and save without it.

All 6 comments

anyone?

I believe this is a known issue that hasn't been fixed yet. I haven't had a chance to look, but I'm certain there's at least one open issue for this already.

there is an easy fix , use required_if instead of required
{ "validation": { "rule": "required_if:id,null", "messages": { "required": "your message" } } }
this will make it required in the create page only, or you can customize it as you wish.
required_if ref.

thankyou @alaamebrahim

that is the actual solution.

i'll close this as resolved

@alaamebrahim It's not really a solution. Because you can delete image and save without it.

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

duongsieu picture duongsieu  路  3Comments

craigb88 picture craigb88  路  3Comments

TPRAsh picture TPRAsh  路  3Comments

abacram picture abacram  路  3Comments

kevinjon27 picture kevinjon27  路  3Comments