This discussion is archived
6 Replies Latest reply: Dec 5, 2011 4:43 PM by Chris Muir RSS

Field level Validation in ADF

Ami Newbie
Currently Being Moderated
Hi,

We have some forms and we want to implement validation on field level. Means, as soon as i enter a value and move to next field, if the value entered is not as per desired regular expression than it should show the error. What i am trying is applying validator attribute on inputText and setting auto submit to true. It is working but some times page suddenly refresh itself and then the validation don't work.

Also one validation is to match the passwords (new password and confirm password). If i am using above method i am also not able to get the correct value of new password to match eith confirm password.

Can someone please suggest whats the right way to implement this functionality in ADF.

I am using jDev 11.1.1.4 and using Placeholder data control.

Please suggest

Thanks
  • 1. Re: Field level Validation in ADF
    Abhijit Dutta Pro
    Currently Being Moderated
    Hi,

    Does this help?

    http://andrejusb.blogspot.com/2008/04/adf-faces-rich-client-complex.html
    http://technology.amis.nl/blog/2099/rich-validation-functionality-in-oracle-adf-faces-11g-rich-components

    ~Abhijit
  • 2. Re: Field level Validation in ADF
    DimitrisStasinopoulos Pro
    Currently Being Moderated
    Hi,

    Regarding regular expressions validations:

    http://blogs.oracle.com/shay/entry/regular_expression_validation

    http://www.gabrielsideras.com/2010/08/22/client-validation-using-a-regular-expression-validator/

    and ofcourse:

    http://docs.oracle.com/cd/E17904_01/web.1111/b31974/bcvalidation.htm

    Regards,
    Dimitris.
  • 3. Re: Field level Validation in ADF
    Ami Newbie
    Currently Being Moderated
    Hi,

    Thanks for the links.

    I am able to apply the field level validation but the problem is using autosubmit=true cause a request to server. This is sometimes causing gap after tab out and a page refresh. So i just want to know if it is right to use autosubmit when there are many fields in the form to be validated as the user tab out or is there any other way? Is java script suggested for such cases?
  • 4. Re: Field level Validation in ADF
    Chris Muir Employee ACE
    Currently Being Moderated
    You only want to use autoSubmit if the validation is to occur on the server (ie. autoSubmit to the server), typically where the validation logic is in a JSF managed bean. If the validator components (eg. f:validator) you're using supports validation on the client (ie. via JavaScript in a browser), then autoSubmit shouldn't be necessary.

    CM.
  • 5. Re: Field level Validation in ADF
    Ami Newbie
    Currently Being Moderated
    Hi Chris,

    Thanks for the reply.

    I need some guidline on the best way to do our validation. We will be getting our data from WebService data control. No application module data controls at all. We need validation on the fileds on submitting the form. Can you please suggest whats the right way of doing this. Should i go with <af:validateRegExp> like tags or should i write code in manages bean and use the validator attribute to link. Our validation are simple like matching Regular Exp or comparing two fileds. We will need same validations to be used on different modules of proj as well.

    Thanks for all your help.
  • 6. Re: Field level Validation in ADF
    Chris Muir Employee ACE
    Currently Being Moderated
    If <af:validateRegExp> meets your requirements then sure, use it. The neat thing about the default validators will do both client side and server side validation. As such bypassing the JavaScript validators by sending raw HTTP requests to your server will still result in the required validation being applied via the server side.

    For cross field validation, that's most easily done at the JSF bean level. It will require a round trip to the server to perform the validation though (rather than just validated at the client level). Is that an issue? There's an alternative solution but if you're not worried about round trips, go with the simple solution.

    CM.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points