Alfresco Share forms: how to define a custom validation-handler for a non-mandatory field?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2013 02:46 PM
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".
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
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"> <forms> <form> <field-visibility> <show id="my:property" /> </field-visibility> <appearance> <field id="my:property" mandatory="true"> <constraint-handlers> <constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.myValidator" event="keyup" /> </constraint-handlers> </field> </appearance> </form> </forms></config>
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
type="LENGTH"
instead, but this also does not get called when the user enters something in the form field and the field.
Labels:
- Labels:
-
Archive
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2014 10:03 AM
Is Javascript solution acceptable? If it is, you can create/add a form or field validators in your dashlet or component code.
