5 Replies Latest reply: Feb 25, 2013 11:15 AM by Howard (... in Training) RSS

    Submit default value on first page load

    992517
      I've built three cascading select lists on the basis of three different LOVs and a chart using the values of the select lists. The first select list has a default value.
      How can I manage to submit this default value on first page load in order to set the values for the other two select lists and show the graph of the chart?

      Without setting any values the user should see the graph when the page loads.
        • 1. Re: Submit default value on first page load
          Ramesh P, Oracle APEX Developer
          Try to have a computation to set the value of the select list if the value is null.
          • 2. Re: Submit default value on first page load
            992517
            Unfortunately, that doesn't fix it
            • 3. Re: Submit default value on first page load
              Howard (... in Training)
              Hello 989514,

              Could you change your number to a handle (Fred, Sue, Nema, Patrick, ...) for us. [I'm Howard.]

              If you're thinking you might visit here often, please see https://forums.oracle.com/forums/ann.jspa?annID=1324.

              Now, to your question. The way I've handled this is with a "first-time" flag. I create an application item :FIRST_TIME and set it to some default value, 'YES'. Then in a before header process on the page, I have:
              BEGIN
                IF :FIRST_TIME = 'YES' THEN
                  SELECT 'default value' INTO :P3_SELECT_LIST_VARIABLE FROM DUAL;
                  SELECT 'NO' INTO :FIRST_TIME FROM DUAL;
                END IF;
              END;
              Regards,
              Howard
              • 4. Re: Submit default value on first page load
                992517
                Thanks for the advice, Howard.
                I think that this could solve my problem.
                I have created the first_time item and the corresponding process. Although I have created a "before process" the process is only active after changing the value of the first select list and not when the page loads.
                What can I do about that behaviour?
                • 5. Re: Submit default value on first page load
                  Howard (... in Training)
                  Hello Yannick,

                  If you created it in the "Before Header" area of "Page Rendering," then it should execute among the very first things on any page load. That's how it works. And, as I recall, page items should have their values immediately for use -- even before any page submits.

                  Here's an example that worked for me:
                    IF :F217_PAGE_NAME_FLAG = 'Month' THEN
                      SELECT :P3_SL_SYS_NIC_NM INTO :F217_SYS_NIC_NM FROM DUAL;
                  ELSE
                      SELECT :F217_SYS_NIC_NM INTO :P3_SL_SYS_NIC_NM FROM DUAL;
                      SELECT 'Month' INTO :F217_PAGE_NAME_FLAG FROM DUAL;
                  END IF;
                  This code was on a page displaying "month" data and here's what it does. If :F217_PAGE_NAME_FLAG = 'Month', we're reloading the Month-page, so save the select list value on this page (:P3_SL_SYS_NIC_NM) in the application item (:F217_SYS_NIC_NM). Other wise I'm coming to the Month-page from some other page, e.g., the Quarter-page, and I want to bring the select list value (saved in :F217_SYS_NIC_NM) and use it to set the currently selected value of the select list on this page. So as I go from page to page to page, whatever I most recently set the select list value to on any page, that's the value I see on the current page. Until I change it to something new.

                  Worked for me in 4.1.

                  (more) And here's a quirk.
                  I don’t understand why yet but neither of these “nulls” the variable where I am using it in P7.
                  :P7_TOO_MANY_PKTS_MSG := NULL;
                  :P7_TOO_MANY_PKTS_MSG := '';
                  So that I could successful test the value, I had to use
                  :P7_TOO_MANY_PKTS_MSG := ' ';
                  to initialize. Was the problem in the initialization -- or in my test? ???

                  Howard