Tapestry
  1. Tapestry
  2. TAPESTRY-742

LinkSubmit renders overly verbose JavaScript

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Component/s: Framework
    • Labels:
      None

      Description

      The LinkSubmit component currently renders a JavaScript function for every LinkSubmit on the page. This is problematic for me because I have a page which could have over 100 LinkSubmits on it (3 LinkSubmits per item with up to 50 items per page). The current JavaScript function which is rendered looks like:

      function onclick_LinkSubmit_0()
      {
      var form = Tapestry.find('Form');

      if (form.events.onsubmit_handler())

      { Tapestry.find('LinkSubmit_0').value = "T"; form.onsubmit = null; form.submit(); }

      }

      The LinkSubmit component could, however, add a static JavaScript file which contains a single function which looks like:

      function onclick_LinkSubmit(form, link)
      {
      var form = Tapestry.find(form);

      if (form.events.onsubmit_handler())

      { Tapestry.find(link).value = "T"; form.onsubmit = null; form.submit(); }

      }

      The values of 'form' and 'link' can be determined at script processing time and the function can be executed by creating a URL which look like:

      <a href="javascript:onclick_LinkSubmit('Form', 'LinkSubmit_0');">Do Something</a>

      This will substantially reduce the amount of JavaScript sent to the browser on a page which includes many LinkSubmits.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Chris Conrad
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development