spdwrench Posted August 7, 2007 Share Posted August 7, 2007 Ok someone should know about this I have a picture upload form I want the upload text in the button to change to loading after a click. so the user knows it's time to wait for the upload <input type="submit" value="Upload"> <input type=hidden name=action value=upload> This is a piece of the form how can I make the value upload... display loading in the button after clicked??? please help Paul Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/ Share on other sites More sharing options...
roopurt18 Posted August 7, 2007 Share Posted August 7, 2007 This is a Javascript issue. HTML is just a formatting language, it doesn't provide any event handling or programming functions. The quick and dirty way, which I whole heartedly do not recommend: <input type="submit" id="btnSubmit" value="Submit"> <script type="text/javascript"> document.getElementById("btnSubmit").onclick = function(){ this.value = "Uploading..."; } </script> That should be more or less it, or get you part of the way there. You should google <i>Javascript event model</i> and <i>Javascript DOM</i> to learn more. Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/#findComment-317973 Share on other sites More sharing options...
spdwrench Posted August 8, 2007 Author Share Posted August 8, 2007 Thanks for the idea.. but the code you wrote was producing an error unexpected { I will look into some website... I have the idea anyway... Paul Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/#findComment-318560 Share on other sites More sharing options...
spdwrench Posted August 8, 2007 Author Share Posted August 8, 2007 If you could tell me why this code is showing an error please let me know? Paul Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/#findComment-318569 Share on other sites More sharing options...
roopurt18 Posted August 8, 2007 Share Posted August 8, 2007 Have a look here; use your browser's "View -> HTML Source" http://ns2271.serverpowered.net/test/test.html Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/#findComment-318586 Share on other sites More sharing options...
php_tom Posted August 8, 2007 Share Posted August 8, 2007 If you could tell me why this code is showing an error please let me know? Paul Try: <script type="text/javascript"> function change() { document.getElementById("btnSubmit").value = "Uploading..."; } </script> <input type="submit" id="btnSubmit" onclick="change();" value="Submit"> Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/#findComment-318714 Share on other sites More sharing options...
spdwrench Posted August 9, 2007 Author Share Posted August 9, 2007 ok I'm getting an error on the Page when I click On details it reads: Unexpected { line 346 I think it might have something to do with the following: the html page upload_photo.html is being called from upload_photo.php parseVariables("templates/upload_photo.html"); Is this preventing it from running the javascript? do I need the javascript in the PHP page? I dunno it's the only thing I can think of Paul Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/#findComment-319481 Share on other sites More sharing options...
spdwrench Posted August 9, 2007 Author Share Posted August 9, 2007 Ok that was it!!!!!!!!! Thanks for your help guys... I needed to put the javascript in the PHP page that was calling the html file works like a charm now... Thanks for all your help Paul Quote Link to comment https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/#findComment-319487 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.