AnsweredAssumed Answered

Field validation during in a Workflow form

Question asked by dranakan on Nov 23, 2011
Latest reply on Feb 28, 2013 by dranakan
Hello,

I would like to the check value of a field in a Workflow form. The verification of a field when it is property of a document is working : http://blog.mwrobel.eu/field-validation-alfresco-share-form/

I get problem to check the field in my workflow… I think that the error comes from my share-config-custom.xml. When the page is displayed, in source code mode in the browser, the link to the js function is not done with the field. I can't see something like this (with field-validation-alfresco-share-form sample) :


fieldId : "template_x002e_edit-metadata_x002e_edit-metadata_x0023_default_prop_ex_gross",
               handler : Alfresco.forms.validation.exampleGrossValidation, …

I try to give access to a function Alfresco.forms.validation.exampleGrossValidation.
My share-config-custom.xml

<config evaluator="string-compare" condition="activiti$Simple">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="bpm:workflowDueDate" />
               <show id="bpm:workflowPriority" />
               <show id="sgfwf:centre1" />
               <show id="bpm:assignee" />
               <show id="packageItems" />
               <!–  <show id="bpm:sendEMailNotifications" /> –>
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
               <set id="assignee" appearance="title" label-id="workflow.set.assignee" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="other" appearance="title" template="/org/alfresco/components/form/table-5-column-set.ftl" label-id="workflow.set.other" />
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="sgfwf:centre1" set="other" help-id="example.price.gross.help" >
                 <constraint-handlers>
                                       <constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.exampleGrossValidation" event="keyup" />
                  </constraint-handlers>
               </field>


Has someone done a field validation during a workflow ?
To validate my field, I need to access an external database… I think it's easier to access in Java code. Can I access my classes from the JS or can I access my classes directly from the form ?

Thanks

(Alfresco 4.0b).

Outcomes