4 Replies Latest reply: May 16, 2013 10:03 AM by fac586 RSS

    Checkboxes that keep their value after a refresh

    1008865
      Hi

      I am trying to work with Checkboxes in an HTML region which will make another region appear or disappear when they are checked or unchecked. As I understand it I need to submit the page to make regions appear or disappear - but when I do this by default the checkbox forgets its value.

      My checkbox is based on the static love: STATIC2:;Y which should make it ticked when the value is 'Y' and unticked when it is 'N'. I have set its default value to Y.

      I have read online about how to make a checkbox remember its value by putting a computation on it that will set the value of the checkbox to 'N' when it is null. Unfortunately when I refresh the page - if the checkbox is ticked then everything is fine (as it was before) - but if it is unticked then I suddenly get two checkboxes - both of which are ticked and one of which has an 'N' after it.

      Does anyone have any idea what I'm doing wrong? It's driving me mad trying to achieve something that that I'd expect to just work without any effort.

      I am using Apex 4.1.1.00.23

      Thanks

      Dan
        • 1. Re: Checkboxes that keep their value after a refresh
          fac586
          user5476823 wrote:
          Hi
          Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already)), and update your forum profile with a real handle instead of "user5476823".

          When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:

          <li>Full APEX version
          <li>Full DB/version/edition/host OS
          <li>Web server architecture (EPG, OHS or APEX listener/host OS)
          <li>Browser(s) and version(s) used
          <li>Theme
          <li>Template(s)
          <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)

          With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
          I am trying to work with Checkboxes in an HTML region which will make another region appear or disappear when they are checked or unchecked. As I understand it I need to submit the page to make regions appear or disappear - but when I do this by default the checkbox forgets its value.

          My checkbox is based on the static love: STATIC2:;Y which should make it ticked when the value is 'Y' and unticked when it is 'N'. I have set its default value to Y.

          I have read online about how to make a checkbox remember its value by putting a computation on it that will set the value of the checkbox to 'N' when it is null. Unfortunately when I refresh the page - if the checkbox is ticked then everything is fine (as it was before) - but if it is unticked then I suddenly get two checkboxes - both of which are ticked and one of which has an 'N' after it.

          Does anyone have any idea what I'm doing wrong? It's driving me mad trying to achieve something that that I'd expect to just work without any effort.
          Don't set the checkbox value to "N". Leave the default as null, and check that the value is "Y" or null as necessary.

          APEX checkboxes probably don't work in the way you expect: a checkbox is displayed for each value in the LOV. With the checkbox item LOV Display Extra Values property set to Yes, extra values that are not included in the LOV definition&mdash;like your "N" default&mdash;will be displayed as additional checkboxes.

          See +{message:id=10738376}+ for a similar situation.
          • 2. Re: Checkboxes that keep their value after a refresh
            1008865
            Thanks for your reply. I have updated my Handle but I gather it'll take 6 hours to show.

            My info is:

            APEX version 4.1.1.00.23
            DB version: 10.2.0.5.0 - Sun Solaris
            Web server architecture - Oracle HTTP server version 11 (OHS)
            Browser - IE 9.0.8112.16421
            Theme: 20. Traditional Blue
            Default Page Template: One Level Tabs
            Print Mode Page Template: Printer Friendly
            Error Page Template: No Tabs
            Region Type - HTML Region

            That's helped a lot - thanks.

            Is there a way to make the checkbox default to ticked without it ticking the unticked ones when I submit the page? Or would I need to create some process that sets the items manually when I navigate to the page?

            Thanks

            Dan

            Edited by: user5476823 on May 15, 2013 11:06 AM
            • 3. Re: Checkboxes that keep their value after a refresh
              fac586
              Dan CondonJones wrote:

              Is there a way to make the checkbox default to ticked without it ticking the unticked ones when I submit the page? Or would I need to create some process that sets the items manually when I navigate to the page?
              This is quite a common situation. The usual approach involves using a further page item to flag whether it is the really the first time the page has been accessed. I find this clunky and unsatisfactory. I'd probably set the default checkbox value in a Before Header computation with a NOT Exists SQL query condition to check whether the page has previously been accessed in the current session:
              select
                  null
              from
                  apex_workspace_activity_log
              where
                  apex_session_id = :app_session
              and application_id = :app_id
              and page_id = :app_page_id
              • 4. Re: Checkboxes that keep their value after a refresh
                1008865
                That's a little bit annoying, but it should work.

                Thanks a lot

                Dan