Please disable your adblock and script blockers to view this page

Search this blog

Friday 23 August 2013

Validation Problem with Cascading mandatory fields in ADF Faces

It is a functional requirement , suppose in application one fields is dependent on another field for its value or any property (required,disable,visible), it means when you select first field and put value in that then second field's value or other property is populated.
or second one is, you have multiple required attributes (cascading) in page and any of that's AutoSubmit  is set to true, in this case when user puts value in first field and goes to second to enter value but before this a large message window appears with required validation and all fields get red




This is very much annoying for user to face this kind of message each time, as i had a scenario where there was 15 required fields in af:form on popup and 10 of that are set to AutoSubmit true .
to avoid this see steps

  • Suppose i have page with create button for Departments table (default HR Schema) on pop up as a form and all fields are reuired
  •  When user clicks on create button and put value in field of DepartmentId, all required fields throw exception

  • To avoid this i have set immediate true for first required field that is DepartmentName, it means when any validation occurs on popup , DepartmentName field will skip all validation on page and will shows only of its own
  •  Now when user put value in DepartmentId field, only DepartmentName field shows exception (required)
 Happy coding......!!

3 comments :

  1. Hi Ashish,

    Is their any better solution. In 12c dialog cancel is depreciated. if I am using buttons to perform save and cancel. on Cancel button immediate property filed is asking as a required.

    Thanks,

    ReplyDelete
    Replies
    1. Hi Siva

      set immediate property of cancel button to true to skip all validation

      Ashish

      Delete
    2. Hi Ashish,

      Thanks for your postings i have a same scenario but with different component in my case am working with af:calendar when user press single click on calendar empty place it was(activityDetail) loading popup perfectly. But when if it's a double click it was throwing validation errors as a list how to prevent that list and i tried immediate=true but it was not solved my issue...

      is there any alternative to handle that dblClick event in af:calendar activityDetail facet.

      Thamks?

      Praveen M90.

      Delete