4 Replies Latest reply on Apr 29, 2013 12:39 PM by Jorge Rimblas

    LOV : changing value issue

      Using Apex 4.0
      I have a form with a report. Form has two LOVs.

      LOV1: Skillset
      LOV2: emp name Cascading LOV is LOV1, Null display value is "Select an employee"

      When I pick a record from bottom report to edit , LOV1 and/or LOV2 display the values as shown in the report row. But If I change, Skillset, focus of the LOV2 changes to "Select an employee" even if new skillset value also has the same employee shown before.
      How can I stop emp name from changing if the new skillset applies to the previously selected employee.


      Edited by: RN on Apr 18, 2013 5:55 AM

      Edited by: RN on Apr 18, 2013 5:55 AM
        • 1. Re: LOV : changing value issue
          Jorge Rimblas
          RN wrote:
          When I pick a record from bottom report to edit
          Could you explain what you're doing when you pick a record?
          Does the form re-load with a new ID? Is it a DA? Javascript? etc?

          Code would be helpful if applicable.

          • 2. Re: LOV : changing value issue
            Thanks Jorge for your reply.

            The two LOVs on the form have source as : Database Column

            And in the report, one of the column has Link that populates a hidden item with the primary key of the table , for that particular row. And that in turn populates LOVs with the value specified for that row.

            So assume : per database
            LOV skillset has : testing and emp name for that skillset is John, Scott
            development and emp_name for that skillset is John, Jerry

            And from the report I picked a row with Skillset as "testing" an emp_name as "John", so LOVs show focus on "testing" and "John"

            But when I change skillset from "testing" to "development" , emp_name LOV is showing "Select an employee". I want it to still show John because John applies to "development" as well.

            • 3. Re: LOV : changing value issue
              Jorge Rimblas
              Ok, sorry, I misunderstood the initial explanation. I see now the report has nothing to do with the situation.
              Unfortunately, the standard APEX Cascading LOV is just not able to do what you ask.
              The main reason is that the dependent LOV entries get wiped out and repopulated when the parent item changes values. Even if it gets populated with the same values as before, this is brand new HTML that gets added to the select.

              One way to solve this would be for you to code the cascading LOV code so that you can mark as "selected" the child value that matches the value form before. There are many examples out there of how to do cascading lov as this feature only came about on a later version of APEX. (Perhaps APEX 4, but not sure about that)
              Here's one example that comes to mind:
              I think you would just need to set the selected keyword on the options that get created by the application process.
              The code could also be improved a little given the new DA features in APEX.

              Another way... and I've never done this, is to perhaps have a javascript timer (or better yet see if there's a cascading lov event that apex generates) and set the value with Javascript after the select list reloads.

              • 4. Re: LOV : changing value issue
                Jorge Rimblas
                I just wanted to mention that Denes Kubicek just linked to a great example on this forum post:
                Cascading LOV - Keep Existing Value

                Here is how he accomplishes this:

                As I said before, it takes some manual effort and some extra code. But it works.
                Hope this helps