statamic / workshop

Create and edit entries, pages, and globals on the front-end of your site without the control panel.
https://statamic.com/marketplace/addons/workshop
3 stars 2 forks source link

Allow an Asset field to Keep Existing Values on Update Forms while the field is Required #22

Closed bgarrant closed 6 years ago

bgarrant commented 6 years ago

Is your feature request related to a problem? Please describe. I have a Workshop form that I want the asset field to be required. Works fine on ADD forms, however on UPDATE forms it does not work as when an asset field is required the file input field requires a new file be uploaded on save, even if you want to keep the existing value.

Describe the solution you'd like It would be great to have a way on the UPDATE form, to allow the asset to still be required in the fields, but have a way to keep the existing value without requiring re-upload of the asset.

Describe alternatives you've considered I was considering an FR to allow inline form field validation parameters in the main workshop tag such as {{ workshop:entry:create collection="events" redirect="/management/dashboard" slugify="title" files="true" required="name-max:50|email|phone"}}.

Additional context AS a quick fix I left the field NOT required in the fields, and I added the HTML5 attribute required so that it is required on the ADD form but not required on the UPDATE form. This allows the existing values to be retained. <input type="file" name="event_image" value="{{ old:image }}" aria-describedby="eventimageHelpText" required>

This feature would be great on ALL frontend forms, not just Workshop.

jasonvarga commented 6 years ago

How is this different from #15 ?

bgarrant commented 6 years ago

@jasonvarga It started out being different with the inline field validation thought, but you can merge them. Forgot about that old one.

jasonvarga commented 6 years ago

Duplicate of #15

jasonvarga commented 6 years ago

No worries