jwktje
Hide a resource widget based on the resource status
Hey everyone. I found the option to hide a widget on a resource with this function:
public static function canView(): bool
The issue is that I want to only show the widget if the resource record/model is in a certain status. But I can't access the record because the function is static. Does anyone know a workaround?
What I would like to do but doesn't work:
Something that feels hacky that works:
12 replies
Dynamic validation based on Select and FileUpload
Hey everyone. I have a form with a Select and a FileUpload for an image. The Select lets a user choose a location where the image must be shown. This dictates the resolution of the image I would want them to upload. Is there any way to create dynamic validation for this?
So the steps would be;
1. FileUpload is disabled until a location is chosen in the Select
2. When a selection is made, I get the
image_width
and image_height
from the Location model
3. A dynamic validation rule is made to enforce that the uploaded image adheres to that resolution
I've tried combining Closure validation rules and Dependant fields, but there seems to be no way to get the current resolution of the uploaded image.
Any help would be greatly appreciated.12 replies