10 Replies Latest reply on Jan 19, 2009 1:02 PM by JKBeyond

    Set item value using AJAX

      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.

        • 1. Re: Set item value using AJAX
          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?
          • 2. Re: Set item value using AJAX

            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).

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


              The "dummy" application process doesn't exist.

              Denes Kubicek
              • 4. Re: Set item value using AJAX
                ^ 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:
                function redir() {
                  var url=window.frames['iframe_window'].location.href;
                Yes, there are various reasons why! :)
                • 5. Re: Set item value using AJAX
                  IFrames!!! I guest Ajax is the way to go then :D

                  • 6. Re: Set item value using AJAX
                    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
                      "Touch screen"? Crikey, that's the first I've heard of Apex being used for that!

                      • 8. Re: Set item value using AJAX
                        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
                          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
                            Got the AJAX method working fine - thank-you very much! :)