The submit_pdf button saves up the information into the database and to avoid multiple clicks, i initially had disabled the submit button after one click, however now i would like to re enable the button after a timeout of 10 seconds. The part till where the submit button gets disabled is working fine, but if i try to add a delay of 10 seconds, it doesn’t seem to work.It would be really helpful if you could help me out with this.
echo ' <script language="JavaScript" type="text/javascript">
//<![CDATA[
window.open(\'./index_pdf.php?'.$query_string.'\',\'Warehouse_ST\',\'location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no\');
id_form.submit_pdf.disabled=true;
window.alert("Data is stored in the database, Please do no click on Submit again without changing any information");
window.addEvent(\'domready''\',function()
{
var subber = $_REQUEST["submit_pdf"];
subber.addEvent( \'click' ,function() '
{
subber.set( \'value','Submitting...''\' ).disabled = true;
(function() { subber.disabled = false; subber.set(\'value','submit_pdf'\'); }).delay(10000); // how much time? 10 seconds
});
});
//]]>
</script>';
try using setTimeout()
define a function to enable the button, and then set a setTimeout():
make sure to put the function name without quotes and without the “()”