Validation -required

Hello Everyone

Greeting!!!

i have two attributes in the one user task the First one like (enum) approve or Rejected. the second attributes is Reason like string.

How can i convert Reason like validation -required when i selected Rejected from Camunda BPM modeler

Regards
Suhaib Sultan

Hi Suhaib,
as far as I know I think you can not do the “conditional validation” with the generated task forms.
I suggest that you should create your own task form (embedded task form), where you can easily do this.
See this https://docs.camunda.org/manual/7.6/user-guide/task-forms/#embedded-task-forms for more information about the forms.
Hope that helps.
Cheers,
Lukas

i think i need to mention that in java code but i do not know how can i mention if i selected Rejected it should be required.

this Java Code::

public class AccountNumberFormFieldValidator implements FormFieldValidator {

private static final String PATTERN = "[0-9]+";

public boolean validate(Object submittedValue, FormFieldValidatorContext validatorContext) {

	Map<String, Object> formValues = validatorContext.getSubmittedValues();
	System.out.println(" formValues" + formValues);
	if (submittedValue instanceof String) {
		String string = (String) submittedValue;

		return string.matches(PATTERN);
	}

	return false;
}

}

Oh, I am sorry I thought we are talking about doing this whole thing in modeler or generated task forms.
Unfortunately, I do not know how to do this in java.

Hello @lhofer87

Is there any workaround to achieve the conditional validation via camunda modeler ?
i.e without coding in JAVA

Thanks

Hi @asperitas_ltd

This topic is 3 years old so probably not a good place to get your question answered.
Can you create a new topic with more details about exactly what you’re trying to achieve and we can try to help you out.