Form Field Validation with Fluent Builder API

I am building a process with a form, and I would like to add a generic read-only text field to it.

Example: A link (the read-only text field) and a checkbox for the user to click on to verify that they have clicked the link

My first thought was to add a form field, and make the field validator “read-only”.
https://docs.camunda.org/manual/7.9/user-guide/task-forms/#form-field-validation

However, I am using the Fluent Builder API, and while there are methods for

camundaId
camundaLabel
camundaType
camundaDefaultValue

There is no implementation for adding validators as shown here in the AbstractCamundaFormFieldBuilder class.

A naive attempt has been made by me to add something like

public B camundaValidator(CamundaValidation validation) {
element.setCamundaValidation(validation);
return myself;
}

But this appears to be much more involved than I previously thought. Any ideas or recommendations?

Hi @dan,

You could add the validators in a non-fluent way, i.e. first build the model and then add the validator elements via the non-fluent APIs. If you would like to extend the builder, we are happy to receive a pull request and can give you feedback on API design.

Cheers,
Thorben

Thorben,

Thanks for the feedback! I am trying it out, and I believe that adding it after-the-fact in a non-fluent way will work.

I much prefer the fluent builder, so if I can get it together I will open a pull request!

1 Like