On 20/05/2010 15:01, Christopher Schultz wrote:
> Pid,
>
> On 5/17/2010 4:43 PM, Pid wrote:
>> On 17/05/2010 21:07, Christopher Schultz wrote:
>>> Karthik,
>>>
>>> On 5/13/2010 3:45 AM, Karthik Nanjangude wrote:
>>>> Question : My web application uses "href" & "css based image's"
>>>> for transferring the request from 1 page to another The problem is
>>>> UserVisitor is clicking the image based href MULTIPLE TIMES (
>>>> multiple clicks )
>>>
>>> Ok.
>>>
>>>> <a href="image.jsp?mult=1" id='submitButton1'
>>>> onClick="this.onclick=function(){return false}" target="_self"
>>>> class="buttonRedSmall"><span>Submit Form</span></a></td>
>>>
>>> That's a nasty construct: when the user clicks the link, you change the
>>> onClick handler? How about this:
>>>
>>> <a href="image.jsp?mult=1" id='submitButton1'
>>> onclick="return false;"
>>> class="buttonRedSmall"><span>Submit Form</span></a>
>
>> The goal of the original code is to change the onclick handler such that
>> on the *second* click, the handler returns false and so stops the
>> action, theoretically preventing the multiple click stream problem.
>
> That's fine, but the onclick handler doesn't do anything but disable
> itself upon the first click. It doesn't need to; after the scriptlet completes it'll continue as normal and (start to) load the contents of the href attribute because the scriptlet didn't return a false value to stop further action, on this occasion. > Perhaps this is a toy example and not the > real thing. Again, this link does not submit a form in the first place > unless a lot of information has been removed. I'd put it down to a slightly muddled OP. > I've toyed with things like this (mostly by disabling form submit > buttons) but I've always been worried that something will interrupt the > submission process itself, leaving a user with a form that will never > submit again. :( > > I'd love to hear some clever solutions to this problem. I started > writing a javascript function that would disable the submit button, then > schedule it to be re-enabled in, say, 30 seconds, but it was a bit fragile. I also found it fragile & prone to sticking in the "disabled" state. Hassan mentions the better alternative. p --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
signature.asc
Description: OpenPGP digital signature
