I just did somthing similar for my "DirtyFormWarning" component.
You might try something like:
___________________________
submitOnce = {
submitting:false;
interceptValidation:function(inv) {
var valid = inv.proceed();
if (!valid) this.submitting=false;
return valid;
}
}
dojo.event.connect("around", tapestry.form.validation, "validateForm",
submitOnce, "interceptValidation");
______________________________
hth,
Marcus
> -----Original Message-----
> From: Geoff Callender [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 15, 2007 4:09 PM
> To: Tapestry users
> Subject: Re: 4.1 and "do it once" components
>
> Thanks, Jesse, but I couldn't get it to work, possibly
> because it's kind of self-referencing?
>
> On 05/05/2007, at 2:01 AM, Jesse Kuhnert wrote:
>
> > Sure ...I think you can generally do something like:
> >
> > -) Use
> > http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-
> > framework/src/js/tapestry/form/validation.js?view=markupas
> > a reference.
> >
> > -) Override tapestry.form.validation.validateForm(form, props) with
> > something else ....Like maybe
> >
> > tapestry.form.validation.validateForm=function(form,props) {
> > var passed = tapestry.form.validation.prototype.apply(this,
> > arguments);
> >
> > // prevent submission
> > return false;
> > }
> >
> > Something like that anyways.
> >
> > On 5/4/07, Geoff Callender <[EMAIL PROTECTED]> wrote:
> >>
> >> I've got this working in 4.0 but need some help getting it working
> >> with 4.1. It involves Tapestry's javascript.
> >>
> >> I have some "do it once" components, eg. SubmitOnce and
> >> DirectLinkOnce; which address the problem of multiple
> clicks (causing
> >> duplicate submissions). I've adapted them from the
> tapestry-bayeaux
> >> project and upgraded them to Tap 4.0.
> >>
> >> In javascript they check if a variable called "ongoingSubmit" is
> >> true. If not, they set it to true and do what Submit or
> DirectLink
> >> would normally do. Otherwise they do nothing, ie. they ignore
> >> multiple clicks. That much works just fine in both 4.0 and 4.1.
> >>
> >> The tricky bit is when client validation detects an error and
> >> therefore ongoingSubmit should be set to false. In 4.0 I
> handle this
> >> by overriding Tapestry javascript in my own script:
> >>
> >> Tapestry.default_invalid_field_handler =
> function(event, field,
> >> message)
> >> {
> >> if (!event.abort && !field.disabled)
> >> {
> >> Tapestry.set_focus(field);
> >> window.alert(message);
> >>
> >> event.abort = true;
> >> event.cancel_handlers = true;
> >>
> >> ongoingSubmit = false;
> >> }
> >> }
> >>
> >> The only difference is one added line
> >>
> >> ongoingSubmit = false;
> >>
> >> Q: In Tap 4.1, what should I do? And is there a more elegant way
> >> than copying and pasting the entire function as I've done?
> >>
> >> Geoff
> >>
> >>
> >>
> >
> >
> > --
> > Jesse Kuhnert
> > Tapestry/Dojo team member/developer
> >
> > Open source based consulting work centered around
> > dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]