Nuxeo Server

How to Add a JSF Form Validation

Updated: December 5, 2017 Page Information Edit on GitHub

This page is scheduled for review and update. Check back soon for updated content!

The document is created and updated using the 'create' or 'update' view. You can check values on this document before it is saved in the repository.

To validate field, you add a JSF validator to the JSF component controlling the field.

If you're using layouts, you can add it as a property to the widget in edit mode.

Without layout:

<h:inputText type="text" id="userNo" value="#{NumberBean.guess}" validator="#{NumberBean.validate}"/>

Inside a layout:

<widget name="title" type="text">
  <translated>true</translated>
  <fields>
    <field>dc:title</field>
  </fields>
  <properties mode="edit">
    <property name="validator">#{myValidatorBean.validateTitle}</property>
  </properties>
</widget>

The method #{NumberBean.validate} method will be called during Process Validations phase to perform correctness checks on the values of this component. The expression must evaluate to a public method that takes FacesContext, UIComponent, and Object parameters, with a return type of void.

If you need to cross validate fields of a document (i.e.: makes sure dc:title and dc:description are different), refer to the the Cross validation with JSF blog entry.

 


5 days ago Manon Lumeau add tags for doc days
a month ago manonlumeau Added content-review-lts2017 label
2 months ago manonlumeau NXDOC-1346-FT review screenshot
a year ago Solen Guitter 30
2 years ago Anahide Tchertchian 29
3 years ago Solen Guitter 28
3 years ago Manon Lumeau 27
3 years ago Manon Lumeau 26
3 years ago Vincent Dutat 25 | link to "Cross validation with JSF"
4 years ago Solen Guitter 24
4 years ago Anahide Tchertchian 23
7 years ago Stéfane Fermigier 21
7 years ago Stéfane Fermigier 22
7 years ago Stéfane Fermigier 20
7 years ago Stéfane Fermigier 19
7 years ago Stéfane Fermigier 18
7 years ago Stéfane Fermigier 17
7 years ago Stéfane Fermigier 16
7 years ago Stéfane Fermigier 15
7 years ago Stéfane Fermigier 14
7 years ago Stéfane Fermigier 13
7 years ago Stéfane Fermigier 12
7 years ago Stéfane Fermigier 11
7 years ago Stéfane Fermigier 10
7 years ago Stéfane Fermigier 9
7 years ago Stéfane Fermigier 8
7 years ago Stéfane Fermigier 7
7 years ago Stéfane Fermigier 6
7 years ago Stéfane Fermigier 5
7 years ago Stéfane Fermigier 4
7 years ago Stéfane Fermigier 3
7 years ago Stéfane Fermigier 2
7 years ago Stéfane Fermigier 1
History: Created by Stéfane Fermigier