Sunday, October 30, 2011

In my previous project I came across a typical problem While trying to enter value using pop up. The problem is If other required fields on same page are not entered and button/link for generating popup pressed , then an error message appears like below. It forces us to enter required values first.

As a work around I have used the option [immediate=true] for the button/link responsible for the pop up to be generated. Please follow below snap shot. Earlier command link selectText has no option set as [immediate=true] and we get above error.

After setting the option [immediate=true] for the command link selectText, above error resolved as we redeploy it.

Below screen shows that all required fields are empty but it is not prompting us to enter required fields while trying to open popup as user can enter data successfully in pop up and no restriction comes from required fields.

Saturday, October 29, 2011

In this blog I am trying to show validation as user tab out any field in ADF. User enter data in a form field and as he tab out the field validation happens and If validation criteria does not meet error message appears.

An ADF application has model and ViewController project. We can create the form in ViewController project. Please follow my previous blogs for the basics of Form generation in ViewController project. So rather than spending much time on the basics like Form generation , I would like to show special things I have done here to accomplish above goal.

Step1: Create a java class and implement javax.faces.validator.Validator,java.io.Serializable. Implementation of Validator will ask for the validate(FacesContext facesContext, UIComponent uiComponent,Object object) method to be Implemented. Here I have created a java class named EmailValidator. This java file can be downloaded from http://www.box.net/shared/cux283rmjp45cl8mry2x link. Similarly we can create another java file for date validation. Please download the same from http://www.box.net/shared/trtvicb7ihesdmy6hpzx link.