cancel
Showing results for 
Search instead for 
Did you mean: 

how to do custom validaton in fdk forms without <constraint type='MANDATORY'>

rajupingili
Champ in-the-making
Champ in-the-making
Hi all,

Am using Alfresco fdk forms, in this i want to do validation like, my chequeNumber should not allow special character  and it is not mandatory filed.In my workflow form i wrote like

<field id="remwf:billNumber" label="Bill Number" set="response" mandatory="true">
                  <control template="/org/alfresco/components/form/controls/textfield.ftl">
                     <control-param name="maxLength">15</control-param>
                     <control-param name="style">width:40%</control-param>
                  </control>
                 <constraint-handlers>
         <constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.specialChar" event="keyup" />
       </constraint-handlers>
  </field>

it is working.but if i remove mandatory="true" or <constraint type="MANDATORY"> , it is not working but my filed for which i want do validation is not mandatory. how can i do this. can any one help me.
3 REPLIES 3

rajupingili
Champ in-the-making
Champ in-the-making
can any one please help

anand6105
Champ in-the-making
Champ in-the-making
Hi rajupingili,

We are also trying to use our custom validation in our workflow forms. We tried the same procedurte what you have mentioned above. But the changes are not reflecting on the workflow form. Can you please share the steps, files and location of those files to implement the same. It would be very helpful for us.

Thanks
Anand

shazada
Star Contributor
Star Contributor
Hi,

What I did was create a new form control and copied the template="/org/alfresco/components/form/controls/textfield.ftl" to my own.

And I removed the * sign which shows mandatory in the field, and because the field isn't actually mandatory it won't give an error.

So in your case just remove:


<#if field.mandatory && !(field.value?is_number) && field.value == "">
            <span class="incomplete-warning"><img src="${url.context}/res/components/form/images/warning-16.png" title="${msg("form.field.incomplete")}" /><span>
         </#if>
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.