AnsweredAssumed Answered

Alfresco Share forms: how to define a custom validation-handler for a non-mandatory field?

Question asked by mathias.lin on Dec 20, 2013
Latest reply on Jan 2, 2014 by zladuric
I have already read the Alfresco documentation as well as the wiki, but still it does not get clear: what's the proper way to define a custom validation-handler for a certain field in an Alfresco Share form?

The problem is that the approach that I found everywhere in the forum always overrides the MANDATORY type, so the validation handler only gets called if the field is set to mandatory="true".

<config evaluator="aspect" condition="my:aspect">
                <show id="my:property" />
                <field id="my:property" mandatory="true">
                        <constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.myValidator" event="keyup" />

But how to define a custom validation-handler for <strong>a field that is not mandatory</strong>? Or else, which is the correct type to choose/override? I tried
instead, but this also does not get called when the user enters something in the form field and the field.