PWaddict Posted February 13 Share Posted February 13 Hello! I would like to have file/image description required. Is it possible? Or should I create a custom field for it? But then how can I output alt attribute value on a TinyMCE image? Link to comment Share on other sites More sharing options...
szabesz Posted February 14 Share Posted February 14 On 2/13/2025 at 7:40 AM, PWaddict said: Is it possible? Just a simple idea: By hooking into the form-building process, you could add the required attribute to the input element. I have no idea if it's actually doable, though. Link to comment Share on other sites More sharing options...
PWaddict Posted February 14 Author Share Posted February 14 5 hours ago, szabesz said: Just a simple idea: By hooking into the form-building process, you could add the required attribute to the input element. I have no idea if it's actually doable, though. If that native description field is actually an inputfield then I guess that might work but currently there is no point to even try anything for now as the images will be uploaded via ProcessPageEditImageSelect and there is a serious issue with it. Link to comment Share on other sites More sharing options...
PWaddict Posted February 14 Author Share Posted February 14 I ended up using a custom image field as required for the image description to add some notes too. With the following hook on ready.php, I just copy the custom image field description value to the native description field so it can be displayed as alt attribute on RTE images. The native description field no need to be displayed in the editor. It can be as 0 on "Number of rows for description field?" $wire->addHookBefore('Pages::saveReady', function($event) { $page = $event->arguments('page'); if ($page->template->name != "my-template") return; foreach($page->images as $image) { $image->description = $image->image_description; } }); 2 Link to comment Share on other sites More sharing options...
IslaPerry Posted February 20 Share Posted February 20 (edited) If you're working with ProcessWire and need to make file/image descriptions required, you might consider using custom hooks to enforce validation. This ensures that every uploaded file has a proper description before saving. Speaking of organizing and structuring content, if you're a student struggling with essays, study moose offers a great selection of essay examples and writing assistance to help you craft well-structured papers. Has anyone here experimented with ProcessWire hooks for mandatory fields? Edited February 27 by IslaPerry Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now