10 Replies Latest reply: Jan 19, 2009 7:02 AM by 603257 RSS

    Set item value using AJAX

    603257
      I want to first set the value of an item and then re-direct to a page. This must be done in javascript (for various reasons). I am OK with the redirect (just calling the APEX redirect() function) however I would like to be able to update an item value first. I assume this is job for AJAX? I am not able to submit the page before re-direction.

      Thank-you
        • 1. Re: Set item value using AJAX
          BillC
          Hi,
          I don't think you have gotten and responses because it seems to be a bit unclear about what you are trying to do.

          You are in a page and someone hits a button and it redirects to another page? and you want to set an ITEM before it goes? or a database item?
          You are wanting to do an update to the database with AJAX as it redirects?
          Bill
          • 2. Re: Set item value using AJAX
            ATD
            Hi,

            It does depend on what you mean by "update an item value first".

            If you just mean that you want to go from page 1 to page 2 and, during the redirect, you want to set an item on page 2, then this can be done in the URL (you can set any page item value in the URL, it doesn't just have to be on the page that you are transferring to).

            If you mean that you have to update a value on a table, then you can either use Ajax OR you can pass a value to page 2 and have a process run on page 2 that does the update for you (perhaps passing a request name in the URL and setting the process to be conditional on this value).

            Andy
            • 3. Re: Set item value using AJAX
              Denes Kubicek
              See this example on how to do that.

              http://htmldb.oracle.com/pls/otn/f?p=31517:229

              The "dummy" application process doesn't exist.

              Denes Kubicek
              -------------------------------------------------------------------
              http://deneskubicek.blogspot.com/
              http://www.opal-consulting.de/training
              http://apex.oracle.com/pls/otn/f?p=31517:1
              -------------------------------------------------------------------
              • 4. Re: Set item value using AJAX
                603257
                ^ Thanks - I will give that a try and let you know later.

                I can't set it in the URL unfortunately. Very basically I am using an iFrame on a page which I have a button on the parent frame to break out of the frame and display the URL inside the iFrame - something along these lines:
                <script>
                function redir() {
                  var url=window.frames['iframe_window'].location.href;
                  redirect(url); 
                }
                </script>
                Yes, there are various reasons why! :)
                • 5. Re: Set item value using AJAX
                  ATD
                  IFrames!!! I guest Ajax is the way to go then :D

                  Andy
                  • 6. Re: Set item value using AJAX
                    603257
                    Yes, they're being used to create a (primitive) touch-screen mode for an application whereby the content is in an iframe with large buttons to scroll etc. The screen needs to be able to toggle between both touchscreen and normal mode though. Sounds like a strange thing to do but without going into too much detail, it's difficult to explain everything!! :)
                    • 7. Re: Set item value using AJAX
                      ATD
                      "Touch screen"? Crikey, that's the first I've heard of Apex being used for that!

                      Andy
                      • 8. Re: Set item value using AJAX
                        603257
                        lol - apart from the issue above, it actually works quite well! :)
                        Bit of CSS required here and there to make things bigger, more easily accessible etc but not a great deal.
                        • 9. Re: Set item value using AJAX
                          ATD
                          If things go the way people suggest, then we'll all be using touchscreens - so, you'll be the expert we can call on ;)
                          • 10. Re: Set item value using AJAX
                            603257
                            Got the AJAX method working fine - thank-you very much! :)