Here is the one I wrote for 5.4. It uses the perpareForSubmit form event

define(["jquery","t5/core/events"], *function*($,events) {



       *return* *function*(parameters) {

             $('#'+parameters.id + ' :submit').removeAttr('disabled');



             $('#'+parameters.id).bind(events.form.prepareForSubmit,
*function*() {

                    $('#'+parameters.id + ' :submit').attr('disabled',
'disabled');

                    $('#'+parameters.id + ' :submit').val("Please Wait")

             });

       };

});



*public* *class* Sub1 {

       @Inject

       *private* JavaScriptSupport javaScriptSupport;



       @Inject

       *private* FormSupport formSupport;



       *void* afterRender(MarkupWriter writer) {

             JSONObject params = *new* JSONObject();

             params.put("id",formSupport.getClientId());

             javaScriptSupport.require("sub1").with(params);

       }



}

On Tue, Dec 2, 2014 at 5:04 AM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Tue, 02 Dec 2014 01:25:18 -0200, Charlouze <m...@charlouze.com> wrote:
>
>  @Thiago: I'd like to inform my user that the form is currently being sent
>> (using an ajax request). That's why I need something similar to the
>> clickOnce example.
>>
>
> You can do that by adapting the example I provided.
>
> You've been actually asking for two different things: preventing double
> submission and some way of knowing a validation error occurred.  The first
> one can be done by adapting the example I provide. The second one can be
> implemented now by checking whether the validation error message HTML
> elements are visible.
>
>  Do you think that adding a validation error event isn't a good idea
>> anyway ? (It would probably serves other purpose for other
>> people)
>>
>
> Yep! JIRA please? :)
>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to