Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-735

SubmitScript component

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 4.1
    • Framework
    • None
    • Tapestry 4.0-beta-12

    Description

      I implemented a SubmitScript component that works in a similar way to LinkSubmit. The only difference is that it doesn't render any links, just the JavaScript function that submits a form and calls a listener

      It can be used on a page, like this:

      <span jwcid="changeName@SubmitScript" action="listener:changeName" />

      And on the field...

      <input jwcid="name@TextField"
      onchange="ognl:components.changeName.href" />

      It only generates a JavaScript in the BODY component, like this:

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

      if (form.events.onsubmit_handler())

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

      }

      And it'll call a listener in the component:

      public void changeName(IRequestCycle cycle) {
      .. // do something
      }

      This is mostly the functionality of Link, but far more flexible. I'm using it to attach listeners to 'onchange' and 'onclick' javascript events, and it could also be used to provide form submission to @DirectLink or @PageLink (LinkSubmit would get deprecated by this).

      This is already implemented, but it still has some app-specific stuff. If people are interested I can remove those things and submit it here.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lquijano Leonardo Quijano Vincenzi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: