2 Replies Latest reply on May 30, 2020 2:17 PM by 4071852

    OAF LOV Validation not firing





      I have a scenario on a OAF page where user enters data into an LOV field, doesn't tab out or hit LOV button and just hits the Apply button after typing in some value in LOV field. In this case, LOV validation doesn't take place and unvalidated value gets saved in database.



      Could anyone please guide me on how to validate LOV in such cases? Any pointer is really appreciate.





        • 1. Re: OAF LOV Validation not firing

          For anyone facing same problem,


          I have now developed a fix for above problem. This is based on the concept that each LOV field has an LOV Map to associated to it.


          I have written code in Controller class processFormRequest on the click of Apply/Save button to :

          1. Loop against all parameters on the page.

          2. If current element is a LOV Display field :

               a. Find its LOV Map element and its value

               b. If LOV Display has a value but LOV map doesn't have , it means that LOV is not validated, then Raise an error.


          Below is the code that i added to Controller class:


          Enumeration enums = pageContext.getParameterNames(); 



            String currElem = enums.nextElement().toString(); 


             String currElemVal = pageContext.getParameter(currElem);

             if ((currElemVal!=null) && isLovDispElem(currElem))  //Custom method, Current elemet is an LOV Display and contains a value


             String parentElem = findparentElem(currElem);   //Custom method, here parent means LOVMAP for that Lov field


             String parentval = pageContext.getParameter(parentElem);   //Value of LOVMap


              if(parentval.length()==0 && currElemVal.length() >0) //LOV Display has value and LOv map is empty- thsi implies LOV has not been validated

          throw new OAException("Please validate LOV for the following value you entered : "+currElemVal,OAException.ERROR);  //throw error






          If you find it helpful, let me know by leaving a comment.



          • 2. Re: OAF LOV Validation not firing

            thanks really helpful