Validate text field on document creation

I have a custom document and I want to validate one of the fields, which is a text field, before document creation. Validation means parsing it against a regular expression. Is there any way to do this in Nuxeo?

0 votes

1 answers

1982 views

ANSWER



Each field is implemented as a JSF component. You can use validation system.

Easy way with Nuxeo Studio/IDE, here is the documentation:

http://doc.nuxeo.com/x/XYSE

But if you want to do it yourself, because you feel as an JSF expert :

http://doc.nuxeo.com/x/pgQz

0 votes



Hi have created a validator but nuxeo can't find it.

I got this error message: validator="#{MyValidator.validate}": Target Unreachable, identifier 'MyValidator' resolved to null

In nuxeo studio, for the widget I want I have the validator set to #{MyValidator.validate} I have added this to the deployment-fragment: <extension target="faces-config#VALIDATOR">

&lt;validator&gt;
    &lt;validator-id&gt;MyValidator&lt;/validator-id&gt;
    &lt;validator-class&gt;com.dm.validators.MyValidator&lt;/validator-class&gt;
&lt;/validator&gt;

</extension>

The com.dm.validators.MyValidator class exists, is public and implements implements javax.faces.validator.Validator.

Can you help me with this?

10/26/2011

I just solved it. Is the code I have above but the validator field must be set to MyValidator.
10/26/2011

I recommend to use Seam component instead a pure JSF validator, for refactoring and managing, all will be easier.
10/26/2011