2 Replies Latest reply on Dec 6, 2018 5:27 PM by John Snyders-Oracle

    apex.util.applyTemplate with selectlist item

    Niels IH

      Hello,

       

      I was wondering why apex.util.applyTemplate substitutes the display value of a selectlist item instead of the actual value.

      Is this intended behaviour or a bug?

       

      For example on a page with a selectlist item P1_DEPT enter this in the console:

       

      console.log(apex.util.applyTemplate("&P1_DEPT."))

       

      It will show the display value of the department instead of the id.

        • 1. Re: apex.util.applyTemplate with selectlist item
          Franck N

          Hi,

           

          This function is intended to process Application Express style templates in the browser. However it doesn't have access to all the data that the server has. When substituting page items and column items it uses the current value stored in the browser not what is in session state on the server. It does not support the old non-exact substitutions (with no trailing dot e.g. &ITEM).

           

           

          regards,

          Franck

          • 2. Re: apex.util.applyTemplate with selectlist item
            John Snyders-Oracle

            Hi,

            It is intended that applyTemplate uses the display value of items. We think this is the most common case since the output of templates is most often used for display. There currently isn't any way to change this. What is your use case where you need the value?

             

            A workaround may be to set a hidden item with the select list item value every time it changes and use the hidden item in the template. Since hide items don't have a display value you will get the value.

             

            Another option is to get the value yourself and put it in the extraSubstitutions option.

             

            Regards,
            -John