I added an alt text field to an asset source and that alt text field is required.
I can upload new files from the assets area or from an entry itself and it never alerts me that the alt text field which is "required" is blank. The only time I can get the validation to occur is if I double click on the asset and get the Quick Edit modal.
So in a sense that field really isn't even required since the validation for it almost never occurs.
Yeah, Craft should be immediately showing a batch-edit screen for each asset you upload, which must be submitted before the uploaded assets are actually saved into the volume.
This will definitely help us as we have 400+ authors entering content hundreds of times a day and we can run afoul of ADA if staffers forget when they aren't required to add alt text to the asset itself.
The next 3.2 Alpha release will have a new “Validate related [element type]” setting on relational fields, which ensures the related elements pass validation before the source element can be saved, which I think will resolve this nicely.
@brandonkelly Tried the 3.2 beta today. Doesn't seem to be working for me?
Got the checkbox ticked for validating related entries. Uploaded a new asset, expected to see a validation error, was able to cancel the dialog as well even after opening it?
@RitterKnightCreative Validation errors don’t occur until you attempt to save the entry, and only if the entry is enabled.
@brandonkelly Does this not work in the Assets view?
For example, client uploads new file for use somewhere in the CMS. I have a related Entry field on that asset (or whatever) with its "validate related entries" box ticked. When I upload the new asset, I should get a pop-up asking to complete the Asset's metadata or is that not how that's supposed to work?
@RitterKnightCreative Ah gotcha. It should work, but not immediately when you first upload the asset - only when you double-click on the asset to change its metadata.
Ensuring an asset validates immediately on upload would be more ideal in your case, but that would require a complete overhaul of how asset uploads work in the first place, so not something that will happen in the near future.
The theory behind the new config setting is that generally assets aren’t queried directly on the front-end; they show up on the front-end if they themselves end up getting related to an entry, via an Assets field. So if you check the “Validate related assets” setting on an Assets field, you will get a more desired workflow, where you can’t publish new versions of the parent entry until all of the related assets are valid. (If those assets have their own nested Entries fields within them, with its “Validate related entries” setting checked, that setting _will_ come into play when saving the parent entry that validates the assets.
@brandonkelly Thanks for the clarification, makes sense.
FWIW my client was trying to use it for organization purposes... which is sort of a separate but related issue. (She would really be better served by being able to edit multiple assets data at once but that's another thread...)
Most helpful comment
Yeah, Craft should be immediately showing a batch-edit screen for each asset you upload, which must be submitted before the uploaded assets are actually saved into the volume.