Form field validation handler issue

Showing results for 
Search instead for 
Did you mean: 
Active Member II

Re: Form field validation handler issue

I do indeed have the config element in the XML.

Thanks for the alternate solution suggestion. Do you happen to have a link to your code please?


Re: Form field validation handler issue

Okay, thanks for checking.

Alternative solution is to create an xml file under src/main/resources/alfresco/web-extension/site-data/extensions. Name it whatever you want, like validator.xml.

In that file you would put something like:

            <id>Someco Share Form Configuration</id>

                            <js src="/resources/someco-share/js/validator.js"/>

                <config evaluator="node-type" condition="sc:doc">
                                <show id="cm:name" />
                                <show id="cm:title" force="true" />
                                <show id="sc:someProp" />

                                <field id="cm:name">
                                        <control-param name="maxLength">255</control-param>
                                <field id="cm:title">
                                    <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                                <field id="sc:someProp" label-id="" description-id="" help-id="">
                                        <constraint type="scDateValidator" message-id="constraint.scDateValidation" validation-handler="SomeCo.forms.validation.scSomePropValidatior" event="onChange"/>






Active Member II

Re: Form field validation handler issue

That is just awesome Jeff, you are a superstar! Using this approach, with minor modifications, the Javascript validator function is now visible in the browser, and is actually being called by my form. You're very welcome to post this answer up on SO, and I'll give you the rep points.

Thanks also to Sanjay Bandhniya for contributing.

Many thanks, I've been banging my head against this brick wall for days. I'd still love to know why the original config approach wasn't working.