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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.