Hi,

I use the following script to do this, it requires the prototype javascript library:

function disableOnClick ( className ) {
    var elements = document.getElementsByClassName( className );
    for ( var index = 0; index < elements.length; index ++ ) {
        Event.observe( elements[index] , 'click', buttonOnClick );
    }
}

function buttonOnClick( e ) {
    Try.these(
        function() {
            e.srcElement.disabled = true;
            e.srcElement.form.submit();
    } ,
        function() {
            e.target.disabled = true;
        }
    );
}


e.g. in your html/jsp page

<input type="submit" class="submitButton" />
<script type="text/javascript">
        disableOnClick( 'submitButton' );
</script>



Some docs on the prototype.js

http://www.sergiopereira.com/articles/prototype.js.html




Hope that helps

Gareth

A Amarakoon wrote:
Thank you for quick reply.. This does not work for me..

once you click the submit button it disables button. but does not submit action 
to
the server. May be I am missing something??

thanks

rukka
----- Original Message -----
From: Jorge Mart�n Cuervo <[EMAIL PROTECTED]>
Date: Wednesday, May 31, 2006 9:19 am
Subject: Re: Disable submit button

<input type="submit"  onclick="this.disabled=true"/>

this works well


PD: i've tested in firefox

El mi�, 31 de 05 de 2006 a las 16:36, rukka escribi�:

As a part of solution to multiple reloads and to block the
multiple
submit requests in long running service layer methods, we like to
disable submit button once user hit that once. Does html:submit
button
tag has java scripts associated with it?

If you do have any links on client side fix, I appriciate that.

thanks

rukka


-----------------------------------------------------------------
----
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
;-)
____________________________________
Jorge Martin Cuervo
Analista Programador

Outsourcing Emarketplace
deFacto Powered by Standards

email <[EMAIL PROTECTED]>
voz +34 985 129 820
voz +34 660 026 384
____________________________________


---------------------------------------------------------------------
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]

Reply via email to