Thank you! I tried to implement this but not much success for now. I'm not really good at js and jQuery so perhaps I'm doing something wrong. Here is my code initialize: function(element)
{ var el = $(element); var form = jQuery(el).closest("form"); form.observe(Tapestry.FORM_VALIDATE_EVENT, function() { console.log("Hey, we're observing!"); ... I get the following error: Uncaught exception: TypeError: 'form.observe' is not a function I have to mention I'm on a bit older version of Tapestry: 5.1.05. There is no Tapestry.FORM_VALIDATE_FIELDS_EVENT defined but there are Tapestry.FORM_VALIDATE_EVENT and Tapestry.FIELD_VALIDATE_EVENT which I guess should do the same thing. -------- Оригинално писмо -------- От: Josh Canfield joshcanfi...@gmail.com Относно: Re: Confirm mixin with form validation errors До: Tapestry users Изпратено на: Петък, 2012, Септември 14 07:07:20 EEST I don't think this addresses the problem though, right? If client-side form validation fails you still are in a state where you can't click the submit button again after fixing the error. Tapestry doesn't have an event for "validation failed", and I don't know of an approved way to workaround that. But! What you can do is add an observer for Tapestry.FORM_VALIDATE_FIELDS_EVENT and set a timeout (1/4 of a second?) to re-enable the field if you don't get a Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT before the timeout. Here is a prototype based on Geoff's example from jumpstart. This was created for submit buttons, you'd have to adjust for links (find the form...) ClickOnce = Class.create( { initialize: function(elementId) { var el = $(elementId); el.clickOnce = this; if ( el['form'] ) { el.form.observe(Tapestry.FORM_VALIDATE_FIELDS_EVENT, function() { console.log("Hey, we're observing!"); el.clickOnce.clickOnceTimeout = window.setTimeout(function(){ console.log("Let them click again") el.clickOnce.alreadyClickedOnce = false; }, 250) }); el.form.observe(Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT, function() { window.clearTimeout(el.clickOnce.clickOnceTimeout); }); } this.alreadyClickedOnce = false; Event.observe(el, 'click', this.doClickOnce.bindAsEventListener(this)); }, doClickOnce: function(e) { var element = Event.element(event); console.log("Clicked"); if (element.clickOnce.alreadyClickedOnce) { console.log("and cancelled"); e.stop(); } element.clickOnce.alreadyClickedOnce = true; } } ); // Extend the Tapestry.Initializer with a static method that instantiates a ClickOnce. Tapestry.Initializer.clickOnce = function(spec) { new ClickOnce(spec.elementId); };