Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6023705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:02:41+00:00 2026-05-23T04:02:41+00:00

I’ve read multiple times that this is the recommended approach to adding client side

  • 0

I’ve read multiple times that this is the recommended approach to adding client side callbacks when a form is submitted, however it isn’t working for me:

<t:form t:id="myForm" id="myForm">
    <t:submit />
</t:form>

<script type="text/javascript">
    $("myForm").observe(Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT, function() {
        alert("submitting");
    });
    alert("listening");
</script>

Can someone point out what I have done wrong?

I’m using tapestry 5.1.0.5

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:02:41+00:00Added an answer on May 23, 2026 at 4:02 am

    There is an interesting defect in 5.1.0.5 (fixed in newer versions)

    A simple page with only doesn’t cause any of the core
    tapestry javascript libraries to load (tapestry.js, prototype.js, etc) So the form is not even hooking onSubmit. Adding validation to a field in the form would fix this, but if you don’t have a field that’s hard.

    If you don’t even have tapestry.js loading in the page then the first step is to make sure you’re doing something that will tell the framework you want it. One way to do this is by calling RenderSupport#addScript. Passing an empty string is ignored so you can stick a semi-colon in it to essentially get a no-op.

    @Inject
    private RenderSupport renderSupport;
    
    void setupRender() {
        // non-blank addScript causes stack to get added
        renderSupport.addScript(";");
    }
    

    The next thing to do would be to call getFormEventManager on your form element to initialize the form for tapestry, and make sure the event handlers are attached.

    I also updated the TML to wait for the dom to load so you don’t get strange timing errors:

    <t:form t:id="myForm">
       <t:submit/>
    </t:form>
    
    <script type="text/javascript">
        Tapestry.onDOMLoaded(function() {
        $('myForm').getFormEventManager(); // forces the form to start listening for submits
        $("myForm").observe(Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT, function() {
           alert("submitting");
        });
        alert("Dom loaded");
      });
    </script>
    

    Obnoxious, but fixed in later versions of the framework.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.