Validation of minlength and maxlength constraints inconsistent

Hello,

a string form field configured like this

<camunda:formField id="StringField" label="A string field" type="string">
  <camunda:validation>
    <camunda:constraint name="minlength" config="4" />
    <camunda:constraint name="maxlength" config="20" />
  </camunda:validation>
</camunda:formField>

produces an exception for “12345678901234567890” but accepts “1234”.

I feel it is inconsistent behavior that minlegth is inclusive and maxlenght is exclusive.

1 Like

Unfortunately we’ve faced with this issue too. In out-of-the-box Tasklist application ‘maxlength’ constraint works correct, but engine generates an error. When this bug will be fixed? Thanks.

Hello @bulbenov,

Could you please provide an example which is working in Tasklist and failing on engine side.
Other than that feel free to open a bug report or raise a pull request.

Best regards,
Yana

Hello @yana.vasileva,

I see @f_a described in details at top. The fix is dead easy - just change ‘<’ to ‘<=’ in MaxLengthValidator.java.

Can you explain me how I can open a bug report and raise a pull request? We’ve worked with Camunda for a month only. At the moment evaluating it for our business.

Thanks a lot.

Hi @bulbenov,

I was curious that it is working in Tasklist for you.
You can open a bug report via Jira [1]
Or if you’re interesting in providing a pull request please check github page [2]
and our How to contribute guide [3]
If you have questions, please do not hesitate to ask.

[1] https://app.camunda.com/jira/secure/CreateIssue!default.jspa
[2] https://github.com/camunda/camunda-bpm-platform/pull/new/master
[3] https://github.com/camunda/camunda-bpm-platform/blob/master/CONTRIBUTING.md

Best regards,
Yana

Hi @yana.vasileva,

I’ve just created issue in your Jira. Hope it will put on in next Camunda release.

Thank you.

@bulbenov if you add this plugin, you can easily add your own JavaScript validation to resolve the issue through the modeler. Form Server Validations: Generic Form Validator using Javascript

1 Like

@StephenOTT, thank you. Your script can be useful in some apps.
However I described bug in camunda engine (general maxlength bpmn constraint validation).

Yes, the bug is identified as part of the validator. But you can still recreate the same validation outcome without using that specific validator; thus bypassing the bug. Using the script validation plugin you can do a min and max length validation directly in Js

ok, but at the moment we’re implementing small processes only via bpmn files (no any other deployments)

Yes :). You can deploy the validation rule as a js file along with you bpmn deployment.