AnsweredAssumed Answered

Alfresco share Form Validation

Question asked by alfsender on Feb 5, 2013
Latest reply on Sep 9, 2013 by iblanco
Hello All,

I am trying to do validation in Alfresco share forms. I have one field say
"cm:name"
which is mandatory. I want to put validation in such a way that when user enters value in this field it should get copied to other field say
"my:productName"
. In case user wants he can modify value of
"my:productName"
.

For that i have created a custom function in forms-runtime.js file "Alfresco.forms.validation.copyProdNameValue". i have added this function to share-config-custom.xml for field
"cm:name"
like below.


<field id="cm:name" label="Name">
  <constraint-handlers>
     <constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.copyProdNameValue" event="keyup"/>
  </constraint-handlers>
</field>


This works when i enter value in
"cm:name"
say "Welcome Product" it copies value("Welcome Product") to
"my:productName"
. But when user modify value of
"my:productName"
(i.e. "Welcome Product") it again calls validation function for
"cm:name"
(i.e. "Alfresco.forms.validation.copyProdNameValue") so it copies value from
"cm:name"
to
"my:productName"
.

I am not sure whether this is default behavior that is serial validation.

Please send your valuable suggestion as putting validation in form is basic requirement.

Thank you.

Outcomes