2 Replies Latest reply on Jun 11, 2012 5:44 AM by knevik

    how to pass parameters to ftl function?

    knevik

      I need to pass a parameter into an ftl function so I can parse it and put it into a select object. the code below works when aipids = "*random*text*" but I can't figure out how to use the parameter passed in from the workflow.

       

      <script type="text/javascript">
      function filllist () {
         var index = 0
         var count = 0
         var aipids = ${aipid}
         while (index < aipids.indexOf("*",index+1)) {
           document.form.VersionId.options[ count ] = new Option(aipids.substring(index+1,aipids.indexOf("*", index+1)),aipids.substring(index+1,aipids.indexOf("*", index+1)))
                 index = aipids.indexOf("*", index+1)
                 count = count + 1
         }
      }
      </script>
      
      

       

      using ${aipid} in the main section shows that aipid does contain a string so it's not that it is empty

        • 1. Re: how to pass parameters to ftl function?
          knevik

          I've figured out a way of doing this an it's to pass the parameter to a hidden text object and then retrieve it from there

           

           

           

          var aipids = document.form.AIPs.value
          

           

           

          <INPUT name="AIPs" type="hidden" value=${aipid}/>

          • 2. Re: how to pass parameters to ftl function?
            knevik

            The way to do this is actually to pass the variable directly into the function

             

            To do this the definition of the function needs to be changed to

             

                 function fillList(aips)

             

            and when calling the variable needs to be surrounded by single quote marks (when just adding to the text of the form on ${aipids} is needed and this was where the problem arose)

             

                 "fillList('${aipids}')"