Form-Field Validation in MAF

Tweet about this on TwitterShare on Facebook13Share on LinkedIn14Share on Google+0

The validation of required fields in web applications is important, and you have to do the same for mobile applications.
In this post I will show how you can validate required fields in Oracle MAF 2.0. To do this, I will use the application of this post: REST/JSON in MAF.
Download the sample application: MAFValidationApp.zip.

Open empEdit page.
Add the Validation Group component to validate required fields.
Go to Components panel > Operations, drag the Validation Group component and drop before the panelFormLayout component.
Set the property: id=”vg1″.

validation-in-maf1

Go to Structure panel, drag the Panel Form Layout component and drop inside the Validation Group component.

validation-in-maf2

Go to Components panel > Operations, drag the Validation Behavior component and drop inside the commandButton components.
Set the property: group=”vg1″.

validation-in-maf3

For some inputText components (employeeId, lastName, email, hireDate and jobId), set the properties: required=”true” and showRequired=”true”.

validation-in-maf4

To add a Validation Rule for firstName attribute, open DataControls.dcx file.
Expand EmployeesPojoDC, choose employee and click the pencil icon to edit.
In the Employee.xml file, click Attributes tab.
In the Attributes page, select the firstName attribute, click Validation Rules tab, and then click the green plus icon to add a new rule.

validation-in-maf5

validation-in-maf6

validation-in-maf7

Deploy the application and enjoy!

validation-in-maf8

Tweet about this on TwitterShare on Facebook13Share on LinkedIn14Share on Google+0

Author: Waslley Souza

Consultor Oracle com foco em tecnologias Oracle Fusion Middleware e SOA. Certificado Oracle WebCenter Portal, Oracle ADF e Java.

Leave a Reply

Your email address will not be published. Required fields are marked *