4 Replies Latest reply: Dec 27, 2012 8:43 AM by Iris 314 RSS

    javascript: fetch value od application item, without submit

    Iris 314
      Hello,

      I have to fetch latest session state value of an application item in my javascript code, without submitting the page.
      I have searched this forum already and found that this
      var x = &APPLICATION_ITEM.
      should do it.

      However, this doesn't get me the latest session state value, it gets me the latest submitted session state value.

      Could someone help me out?

      Thank you so much.
        • 1. Re: javascript: fetch value od application item, without submit
          fac586
          Iris 314 wrote:

          I have to fetch latest session state value of an application item in my javascript code, without submitting the page.
          I have searched this forum already and found that this
          var x = &APPLICATION_ITEM.
          should do it.

          However, this doesn't get me the latest session state value, it gets me the latest submitted session state value.

          Could someone help me out?
          See +{message:id=9668709}+

          However, if an application item value is changing without submitting the page, the current page must be doing something to change it. Theoretically the value should already be available somewhere on the page.
          • 2. Re: javascript: fetch value od application item, without submit
            714270
            Iris 314 wrote:
            Hello,

            I have to fetch latest session state value of an application item in my javascript code, without submitting the page.
            I have searched this forum already and found that this
            var x = &APPLICATION_ITEM.
            I really doubt that this a valid JS code.
            should do it.

            However, this doesn't get me the latest session state value, it gets me the latest submitted session state value.

            Could someone help me out?

            Thank you so much.
            Application items are not rendered on the page and therefore, cannot be directly accessed by the javascript function. To access the application item's value in your page, one of the options is to create a hidden page item and compute its value using the application item. You should then be able to use the application item's value in your JS function using $v function as:
            var x = $v('<your-hidden-page-item-name>');
            Edited by: Rohit Kapoor on Dec 26, 2012 3:32 AM
            • 3. Re: javascript: fetch value od application item, without submit
              Iris 314
              This answered my question, thank you so much!

              The current page actually executes an application process which is a stored procedure, and that process changes the value of the application item.
              • 4. Re: javascript: fetch value od application item, without submit
                Iris 314
                Thank you, hidden item and the computation of that item was a really nice idea. However, I didn't know how to get the hidden item to refresh ti reflect new values without submitting the page.
                But I'm sure that idea will come in handy, sooner or later. :)