gscorreia93

Validation handler not deploying javascript in war

Discussion created by gscorreia93 on Jan 3, 2019

Hello,

 

I am having a problem creating a custom validation handler in my alfresco. Whenever I start alfresco the war doesn't include my javascript file (test.js) that I placed inside the share project in the resources folder. When I try to use the form and the handler should come into action I get a error 404 saying that the resource test.js in not available. The path for my javascript file is: src/main/resources/js/test.js

 

share-custom-config.xml:

<config>
    <forms>
        <dependencies>
           <js src="/js/test.js"/>
        </dependencies>
    </forms>
</config>

 

<field id="dts:field1" >
          <constraint-handlers>
             <constraint type="MANDATORY" validation-handler="MyCustomNamespace.validateForm" event="keyup"/>
           </constraint-handlers>
</field>

 

test.js:

if (typeof MyCustomNamespace == "undefined" || !MyCustomNamespace) {
var MyCustomNamespace = {};
}

MyCustomNamespace.validateForm =
function validateForm(field, args, event, form, silent, message) {
...
}

Am I doing something wrong? I followed the documentation on the alfresco website:

Form Field Validation Handlers | Alfresco Documentation 

 

Thanks in advance for any help

regards

Outcomes