acook Posted June 18, 2007 Share Posted June 18, 2007 Hello, I am writing a form, and I would like the "Submit" button to be greyed out when it's clicked ...I tried to use <input type="submit" value="Search"/ onclick="this.disabled='disabled'"> But it just greys out the button and does not process the form. Does anyone know how to write something similar in PHP? Also, is it possible to create a message under the button that says something like "Hang tight...this might take a minute."? I'm sure it's possible with Javascript but was thinking it might be possible in PHP?? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/56092-greying-out-submit-button-in-php/ Share on other sites More sharing options...
acook Posted June 18, 2007 Author Share Posted June 18, 2007 Actually, it looks like it works with onClick=this.disabled=true;this.form.submit(); But it'd still be nice to know how to create a little "Please wait" message... Quote Link to comment https://forums.phpfreaks.com/topic/56092-greying-out-submit-button-in-php/#findComment-277018 Share on other sites More sharing options...
Orio Posted June 18, 2007 Share Posted June 18, 2007 You can do something like this: <form action="page2.php" onsubmit="button1.disabled=true; button1.value='Hold on!'; return true" method="POST"> <input type="submit" name="button1" value="Search!"> </form> This has nothing to do with PHP tho. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/56092-greying-out-submit-button-in-php/#findComment-277019 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.