Cep Posted November 17, 2006 Share Posted November 17, 2006 Hi,I basically want to rename a submit button and disable it when I submit a form to prevent the user from clicking it again and again whilst my PHP works through its processes.I have this as my button,[code]<input name="submit" type="submit" class="input" value="Build report" onclick="this.submit=true; this.value='Building...'"/>[/code]and on my form element I have,[code]<form name="statusoptions" method="post" action="reports.php" onsubmit="Disable(this.submit);">[/code]However I keep receiving an error in IE6 that the an object is expected (the form element line) however I don't understand what the problem is as I think I have declared the button by using this.submit.Can anyone tell me what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
extrovertive Posted November 17, 2006 Share Posted November 17, 2006 Take out the onsubmit in your form tag.Just do this in your submit button[code]<input name="submit" type="submit" class="input" value="Build report" onclick="this.disabled=true; this.value='Building...'" />[/code] Quote Link to comment Share on other sites More sharing options...
Cep Posted November 20, 2006 Author Share Posted November 20, 2006 Hi, this appears to work by prevents the form from submitting. I have renamed my submit button as I have been told that it is not a good idea to name it "submit".Any ideas? Quote Link to comment Share on other sites More sharing options...
fenway Posted November 21, 2006 Share Posted November 21, 2006 I'm confused as to what the problem is now. Quote Link to comment Share on other sites More sharing options...
Cep Posted November 21, 2006 Author Share Posted November 21, 2006 The button disables and changes its value which is the desired effect but now the form does not submit. Quote Link to comment Share on other sites More sharing options...
fenway Posted November 21, 2006 Share Posted November 21, 2006 Ah... simply add a "this.form.submit" to the end of your onclick handerl. Quote Link to comment Share on other sites More sharing options...
Cep Posted November 22, 2006 Author Share Posted November 22, 2006 Cheers for that! It works yay!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.