mibu31's avatar

Update File Uploads / Required

Hi guys,

When updating a model which has file inputs, those file inputs cannot be pre-populated (model binding / manually) with a value. Using the "required" validation rule on those inputs means the form can not be validated as they are seen as empty/invalid even though they actually have a valid value from the initial creation. I've tried adding hidden inputs below the file inputs but still no luck? I can't seem to find anything about this online so maybe I've just been really silly and overlooked something? I hope I've explained the situation well enough, it's quite difficult to put into words!

Thanks for reading and I really do appreciate any help/responses. Mike

0 likes
3 replies
mibu31's avatar

Thank you MThomas! I still can't get it working quite how I'd like it though :(

I've got "sometimes|required" - however blank file inputs show as NULL which means the required is still run as the input is in the Input:: array.

Looks like I'll need to try the closure / condition statements or I'm welcome to suggestions!

1 like
mibu31's avatar

Resolved :) - Thanks MThomas!

For those interested - I made a method in my Validator class that will unset file inputs if they're null, and therefore "sometimes|required" is now working how I needed it to! Hopefully I won't have any problems doing that!

1 like

Please or to participate in this conversation.