Jump to content

[SOLVED] help with form submit button...


spdwrench

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/63802-solved-help-with-form-submit-button/
Share on other sites

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.

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.