Form Validation/Dependencies from Code Studio Widget

Hi,

I’m developing a widget in the code studio and I would like to be a able to use it to validate a form or to be used as a condition in a dependency.

I’ve had a look through the documentation within the code studio but I couldn’t find anything. Is there anyway to achieve this?

Thanks, Ewan

Hi Ewan

Just so I fully understand your issue, are you wanting to use the widget as part of the form submission or are you creating a form within the widget and saving via AJAX?

If you are wanting to build custom validation for a field within a form, you can use “Fragment Validators” to achieve this.

Regards
Liam

Hi Liam,

Apologies for not responding sooner. I want to be able to use the widget as part of the form submission, however because it is a code studio widget, there’s no option to use a Fragment Validator on it.

For some context, the widget is a file uploader so I want to check that a minimum number of files have been uploaded to the widget before the form can be submitted. Ideally I would have a setting on the widget for the minimum number of files that would need to be uploaded.

I thought about using a subset to count the files that would then control the visibility of the submit button, but this would mean that the page would have to be reloaded after every upload. It would also mean that a setting for the minimum number of files wouldn’t be possible.

Is there some way of setting up custom validation for a widget that I’m missing?

Thanks,
Ewan