You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Sanchez <d....@ibermatica.com> on 2009/03/16 11:35:20 UTC

Prevent multiple submits with t5.0.14

Hi to everybody. First of all, I want to thank all the people in this mailing
list for their work and support. As you can imagine, i have a problem
tapestry:

Our customer has requested to prevent the forms of multiple submitting. The
first way that we thought was  editing the visibility property of the submit
component in order to make it dissapear, but the customer has rejected that
solution.

So, here I am, writing in this mailing list and asking all the guys: is
there any way to disable the button after the submitting?

Thank you so much in advance


-- 
View this message in context: http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22535389.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by Daniel Sanchez <d....@ibermatica.com>.
Hi Jakub! =^D

I'm gonna check the sample and the suitability for my application. I will
write you as soon as possible :D

Jakub Vlasak wrote:
> 
> Hi Daniel,
> 
> perhaps you should try the Click once mixin example at jumpstart site:
> http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1
> 
> On Tue, Mar 17, 2009 at 11:14 AM, Daniel Sanchez <
> d.alonso.sanchez@ibermatica.com> wrote:
> 
>>
>> Thanks, Inge . In fact, I'm using firebug, due to thit, i can check that
>> after loading the page, that method is called but... after clicking the
>> button nothing happens (the button is not disabled but the form is
>> submitted)
>>
>> Maybe I should try the hidding buttons solution %-|
>>
>>
>> Inge Solvoll-2 wrote:
>> >
>> > Are you using firebug? If so, you should be able to track down variable
>> > content in your script to get a better look at what's going on. Also,
>> try
>> > to
>> > split your code into more lines, and use alerts to view the values when
>> > your
>> > code is run (if you don't use firebug).
>> >
>> > On Tue, Mar 17, 2009 at 9:32 AM, Daniel Sanchez <
>> > d.alonso.sanchez@ibermatica.com> wrote:
>> >
>> >>
>> >> Well, after many tries... i have put scriptaculous into my webapp. I
>> have
>> >> checked that the method Tapestry.onDOMLoaded() is called, but when the
>> >> button is clicked, nothings get disabled.
>> >>
>> >> The function looks like this:
>> >>
>> >> Tapestry.onDOMLoaded(function() {
>> >>                    Event.observe('presentar', 'click', function(event)
>> {
>> >>                        $('presentar').disabled = true;
>> >>                    });
>> >>                });
>> >>
>> >> And the code:
>> >>
>> >> input type="submit" t:type="submit" t:id="presentar"
>> >> value="${message:presentar}" class="boton"
>> >>
>> >> What i'm doing wrong? Thanks a lot again
>> >>
>> >>
>> >>
>> >> Thiago H. de Paula Figueiredo wrote:
>> >> >
>> >> > On Mon, Mar 16, 2009 at 11:00 AM, Daniel Sanchez
>> >> > <d....@ibermatica.com> wrote:
>> >> >
>> >> >> Thiago, sorry for disturbing again but... Must i add any other
>> piece
>> >> of
>> >> >> code
>> >> >> to your snipet for make it work?
>> >> >
>> >> > 1) Just make sure that Prototype is included in your page. If not,
>> >> > take a look at the T5 and Javascript explained page.
>> >> > 2) Make sure your link has an id attribute and its value is the same
>> >> > used in the snippet.
>> >> >
>> >> > --
>> >> > Thiago
>> >> >
>> >> >
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22554505.html
>> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> >> For additional commands, e-mail: users-help@tapestry.apache.org
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22556047.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22557602.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by Jakub Vlasak <jw...@gmail.com>.
Hi Daniel,

perhaps you should try the Click once mixin example at jumpstart site:
http://jumpstart.doublenegative.com.au:8080/jumpstart/examples/javascript/creatingmixins1

On Tue, Mar 17, 2009 at 11:14 AM, Daniel Sanchez <
d.alonso.sanchez@ibermatica.com> wrote:

>
> Thanks, Inge . In fact, I'm using firebug, due to thit, i can check that
> after loading the page, that method is called but... after clicking the
> button nothing happens (the button is not disabled but the form is
> submitted)
>
> Maybe I should try the hidding buttons solution %-|
>
>
> Inge Solvoll-2 wrote:
> >
> > Are you using firebug? If so, you should be able to track down variable
> > content in your script to get a better look at what's going on. Also, try
> > to
> > split your code into more lines, and use alerts to view the values when
> > your
> > code is run (if you don't use firebug).
> >
> > On Tue, Mar 17, 2009 at 9:32 AM, Daniel Sanchez <
> > d.alonso.sanchez@ibermatica.com> wrote:
> >
> >>
> >> Well, after many tries... i have put scriptaculous into my webapp. I
> have
> >> checked that the method Tapestry.onDOMLoaded() is called, but when the
> >> button is clicked, nothings get disabled.
> >>
> >> The function looks like this:
> >>
> >> Tapestry.onDOMLoaded(function() {
> >>                    Event.observe('presentar', 'click', function(event) {
> >>                        $('presentar').disabled = true;
> >>                    });
> >>                });
> >>
> >> And the code:
> >>
> >> input type="submit" t:type="submit" t:id="presentar"
> >> value="${message:presentar}" class="boton"
> >>
> >> What i'm doing wrong? Thanks a lot again
> >>
> >>
> >>
> >> Thiago H. de Paula Figueiredo wrote:
> >> >
> >> > On Mon, Mar 16, 2009 at 11:00 AM, Daniel Sanchez
> >> > <d....@ibermatica.com> wrote:
> >> >
> >> >> Thiago, sorry for disturbing again but... Must i add any other piece
> >> of
> >> >> code
> >> >> to your snipet for make it work?
> >> >
> >> > 1) Just make sure that Prototype is included in your page. If not,
> >> > take a look at the T5 and Javascript explained page.
> >> > 2) Make sure your link has an id attribute and its value is the same
> >> > used in the snippet.
> >> >
> >> > --
> >> > Thiago
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> > For additional commands, e-mail: users-help@tapestry.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22554505.html
> >> Sent from the Tapestry - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22556047.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Prevent multiple submits with t5.0.14

Posted by Daniel Sanchez <d....@ibermatica.com>.
Thanks, Inge . In fact, I'm using firebug, due to thit, i can check that
after loading the page, that method is called but... after clicking the
button nothing happens (the button is not disabled but the form is
submitted)

Maybe I should try the hidding buttons solution %-|


Inge Solvoll-2 wrote:
> 
> Are you using firebug? If so, you should be able to track down variable
> content in your script to get a better look at what's going on. Also, try
> to
> split your code into more lines, and use alerts to view the values when
> your
> code is run (if you don't use firebug).
> 
> On Tue, Mar 17, 2009 at 9:32 AM, Daniel Sanchez <
> d.alonso.sanchez@ibermatica.com> wrote:
> 
>>
>> Well, after many tries... i have put scriptaculous into my webapp. I have
>> checked that the method Tapestry.onDOMLoaded() is called, but when the
>> button is clicked, nothings get disabled.
>>
>> The function looks like this:
>>
>> Tapestry.onDOMLoaded(function() {
>>                    Event.observe('presentar', 'click', function(event) {
>>                        $('presentar').disabled = true;
>>                    });
>>                });
>>
>> And the code:
>>
>> input type="submit" t:type="submit" t:id="presentar"
>> value="${message:presentar}" class="boton"
>>
>> What i'm doing wrong? Thanks a lot again
>>
>>
>>
>> Thiago H. de Paula Figueiredo wrote:
>> >
>> > On Mon, Mar 16, 2009 at 11:00 AM, Daniel Sanchez
>> > <d....@ibermatica.com> wrote:
>> >
>> >> Thiago, sorry for disturbing again but... Must i add any other piece
>> of
>> >> code
>> >> to your snipet for make it work?
>> >
>> > 1) Just make sure that Prototype is included in your page. If not,
>> > take a look at the T5 and Javascript explained page.
>> > 2) Make sure your link has an id attribute and its value is the same
>> > used in the snippet.
>> >
>> > --
>> > Thiago
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22554505.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22556047.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by Inge Solvoll <in...@gmail.com>.
Are you using firebug? If so, you should be able to track down variable
content in your script to get a better look at what's going on. Also, try to
split your code into more lines, and use alerts to view the values when your
code is run (if you don't use firebug).

On Tue, Mar 17, 2009 at 9:32 AM, Daniel Sanchez <
d.alonso.sanchez@ibermatica.com> wrote:

>
> Well, after many tries... i have put scriptaculous into my webapp. I have
> checked that the method Tapestry.onDOMLoaded() is called, but when the
> button is clicked, nothings get disabled.
>
> The function looks like this:
>
> Tapestry.onDOMLoaded(function() {
>                    Event.observe('presentar', 'click', function(event) {
>                        $('presentar').disabled = true;
>                    });
>                });
>
> And the code:
>
> input type="submit" t:type="submit" t:id="presentar"
> value="${message:presentar}" class="boton"
>
> What i'm doing wrong? Thanks a lot again
>
>
>
> Thiago H. de Paula Figueiredo wrote:
> >
> > On Mon, Mar 16, 2009 at 11:00 AM, Daniel Sanchez
> > <d....@ibermatica.com> wrote:
> >
> >> Thiago, sorry for disturbing again but... Must i add any other piece of
> >> code
> >> to your snipet for make it work?
> >
> > 1) Just make sure that Prototype is included in your page. If not,
> > take a look at the T5 and Javascript explained page.
> > 2) Make sure your link has an id attribute and its value is the same
> > used in the snippet.
> >
> > --
> > Thiago
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22554505.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Prevent multiple submits with t5.0.14

Posted by Daniel Sanchez <d....@ibermatica.com>.
Well, after many tries... i have put scriptaculous into my webapp. I have
checked that the method Tapestry.onDOMLoaded() is called, but when the
button is clicked, nothings get disabled.

The function looks like this:

Tapestry.onDOMLoaded(function() {
		    Event.observe('presentar', 'click', function(event) {
		        $('presentar').disabled = true;
		    });
		});

And the code:

input type="submit" t:type="submit" t:id="presentar" 
value="${message:presentar}" class="boton"

What i'm doing wrong? Thanks a lot again



Thiago H. de Paula Figueiredo wrote:
> 
> On Mon, Mar 16, 2009 at 11:00 AM, Daniel Sanchez
> <d....@ibermatica.com> wrote:
> 
>> Thiago, sorry for disturbing again but... Must i add any other piece of
>> code
>> to your snipet for make it work?
> 
> 1) Just make sure that Prototype is included in your page. If not,
> take a look at the T5 and Javascript explained page.
> 2) Make sure your link has an id attribute and its value is the same
> used in the snippet.
> 
> -- 
> Thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22554505.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, Mar 16, 2009 at 11:00 AM, Daniel Sanchez
<d....@ibermatica.com> wrote:

> Thiago, sorry for disturbing again but... Must i add any other piece of code
> to your snipet for make it work?

1) Just make sure that Prototype is included in your page. If not,
take a look at the T5 and Javascript explained page.
2) Make sure your link has an id attribute and its value is the same
used in the snippet.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by Daniel Sanchez <d....@ibermatica.com>.
Thiago, sorry for disturbing again but... Must i add any other piece of code
to your snipet for make it work?

Thanks again


Thiago H. de Paula Figueiredo wrote:
> 
> On Mon, Mar 16, 2009 at 10:00 AM, Daniel Sanchez
> <d....@ibermatica.com> wrote:
>> onclick="this.disabled='true'"
> 
> Instead of using inline JavaScript, use Event.observe from Prototype,
> something like this:
> 
> <script type="text/javascript">
> <!--
> Tapestry.onDOMLoaded(function() {
>     Event.observe('linkId', 'click', function(event) {
>         $('linkId').disabled = true;
>     });
> });
> // -->
> </script>
> 
> Prototype's documentation about Event.observe is here:
> http://www.prototypejs.org/api/event/observe.
> By the way, read
> http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained. It
> explains very nicely the proper way of using JavaScript in Tapestry.
> 
> -- 
> Thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22538819.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, Mar 16, 2009 at 10:00 AM, Daniel Sanchez
<d....@ibermatica.com> wrote:
> onclick="this.disabled='true'"

Instead of using inline JavaScript, use Event.observe from Prototype,
something like this:

<script type="text/javascript">
<!--
Tapestry.onDOMLoaded(function() {
    Event.observe('linkId', 'click', function(event) {
        $('linkId').disabled = true;
    });
});
// -->
</script>

Prototype's documentation about Event.observe is here:
http://www.prototypejs.org/api/event/observe.
By the way, read
http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained. It
explains very nicely the proper way of using JavaScript in Tapestry.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by Daniel Sanchez <d....@ibermatica.com>.
In fact it was the first idea that came from my mind, but after testing it,
i've discovered that no request is made to the server. The submit button is
disabled, an so on, no request is made.

onclick="this.disabled='true'"

Thanks for your response, thiago 


Thiago H. de Paula Figueiredo wrote:
> 
> On Mon, Mar 16, 2009 at 7:35 AM, Daniel Sanchez
> <d....@ibermatica.com> wrote:
>> So, here I am, writing in this mailing list and asking all the guys: is
>> there any way to disable the button after the submitting?
> 
> Disable the button using JavaScript.
> 
> -- 
> Thiago
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22537604.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, Mar 16, 2009 at 7:35 AM, Daniel Sanchez
<d....@ibermatica.com> wrote:
> So, here I am, writing in this mailing list and asking all the guys: is
> there any way to disable the button after the submitting?

Disable the button using JavaScript.

-- 
Thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by Daniel Sanchez <d....@ibermatica.com>.
Hi again! Thanks to both of you a lot!

Umm, martijn, I don't know the particular behaviour of that idea, because
after a user clicks on the button, the onSelectedFromButton method is called
and after that, there is a transition to another page. We need to disable
the button while the actual page is still sending the form (i don't know if
the explanation is right, because some time has passed since the last time I
spoke english more often...

On the other hand, Thiago: thanks a lot for your response again. I'm going
to give a try to that and response you as soon as possible.

More things soon!



martijn.list wrote:
> 
> Daniel Sanchez wrote:
>> So, here I am, writing in this mailing list and asking all the guys: is
>> there any way to disable the button after the submitting?
> 
> Why don't you set a flash persistent boolean after the submission and 
> disable to button in the render phase when the boolean indicates that 
> the form has been posted?
> 
> 
> This should also work when javascript is disabled.
> 
> Martijn
> 
> -- 
> Djigzo open source email encryption www.djigzo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Prevent-multiple-submits-with-t5.0.14-tp22535389p22538227.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Prevent multiple submits with t5.0.14

Posted by "martijn.list" <ma...@gmail.com>.
Daniel Sanchez wrote:
> So, here I am, writing in this mailing list and asking all the guys: is
> there any way to disable the button after the submitting?

Why don't you set a flash persistent boolean after the submission and 
disable to button in the render phase when the boolean indicates that 
the form has been posted?


This should also work when javascript is disabled.

Martijn

-- 
Djigzo open source email encryption www.djigzo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org