HighDots Forums  

Using an image as submit button

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Using an image as submit button in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kim
 
Posts: n/a

Default Using an image as submit button - 09-25-2005 , 05:44 PM






Hello
I'm trying to learn to how to use an image as a submit button.
I'm using the example found at
http://www.webdevelopersnotes.com/tips/html/21.php3

My original submit syntax:
<input type="submit" name="submit" value="SubmitOrder"><input type="hidden"
name="config" value="0" />
contains:
<input type name="config" and value="0" /> that is required by my PHP
script.

Using the new Image submit syntax:
<form name="orderform"><a href="javascript:document.orderform.submit()"
onclick="return val_form_this_page()"><img src="prepay.gif" border="0"
ALT="Submit Order"></A>

I can't find a place for the equivalent of <input type="hidden"
name="config" value="0" />

I have tried it in different places but it fails.

Any suggestions appreciated.



Reply With Quote
  #2  
Old   
mscir
 
Posts: n/a

Default Re: Using an image as submit button - 09-25-2005 , 07:18 PM






Kim wrote:

Quote:
Hello
I'm trying to learn to how to use an image as a submit button.
I'm using the example found at
http://www.webdevelopersnotes.com/tips/html/21.php3

My original submit syntax:
input type="submit" name="submit" value="SubmitOrder"><input type="hidden"
name="config" value="0" /
contains:
input type name="config" and value="0" /> that is required by my PHP
script.

Using the new Image submit syntax:
form name="orderform"><a href="javascript:document.orderform.submit()"
onclick="return val_form_this_page()"><img src="prepay.gif" border="0"
ALT="Submit Order"></A

I can't find a place for the equivalent of <input type="hidden"
name="config" value="0" /

I have tried it in different places but it fails.

Any suggestions appreciated.
Hi Kim,

I found a good discussion of using images as submit buttons here:

http://www.cs.tut.fi/~jkorpela/forms/imagebutton.html

If you still want to use an image button to submit your form, the page
has a code example.

Read "Notes on the JavaScript surrogate" to see why it points to a
"fail.html" page.

There is also code to use to have a button rollover effect "Rollover
effects".

The hidden field can go anywhere in your form. You can place all of the
hidden fields you need anywhere in the form.

<form name="orderform">
<input type="hidden" name="config" value="0" />
<a href="fail.html" onclick="document.myform.submit();return false;">
<img alt="Submit Order" src="prepay.gif" border="0"></a>
</form>

Will that work for you?
Mike


Reply With Quote
  #3  
Old   
Kim
 
Posts: n/a

Default Re: Using an image as submit button - 09-25-2005 , 09:47 PM



"mscir" <mscir (AT) yahoo (DOT) com> wrote

Quote:
Kim wrote:

Hello
I'm trying to learn to how to use an image as a submit button.
I'm using the example found at
http://www.webdevelopersnotes.com/tips/html/21.php3

My original submit syntax:
input type="submit" name="submit" value="SubmitOrder"><input
type="hidden"
name="config" value="0" /
contains:
input type name="config" and value="0" /> that is required by my PHP
script.

Using the new Image submit syntax:
form name="orderform"><a href="javascript:document.orderform.submit()"
onclick="return val_form_this_page()"><img src="prepay.gif" border="0"
ALT="Submit Order"></A

I can't find a place for the equivalent of <input type="hidden"
name="config" value="0" /

I have tried it in different places but it fails.

Any suggestions appreciated.

Hi Kim,

I found a good discussion of using images as submit buttons here:

http://www.cs.tut.fi/~jkorpela/forms/imagebutton.html

If you still want to use an image button to submit your form, the page
has a code example.

Read "Notes on the JavaScript surrogate" to see why it points to a
"fail.html" page.

There is also code to use to have a button rollover effect "Rollover
effects".

The hidden field can go anywhere in your form. You can place all of the
hidden fields you need anywhere in the form.

form name="orderform"
input type="hidden" name="config" value="0" /
a href="fail.html" onclick="document.myform.submit();return false;"
img alt="Submit Order" src="prepay.gif" border="0"></a
/form

Will that work for you?
Mike
Mike

I tested the <input type="hidden" name="config" value="0" /> elsewhere in
my "form", it still didn't work. I received the same "No form data has been
sent to the script" error message.

My <input type="hidden" name="config" value="0" /> can't really go
"anywhere" in my form. The same form is sent to 2-3 different places
depending on payment method. In payment method 2, <input type="hidden"
name="config" value="1" /> is used, and so on...

Originally, this line was in two separate Submits: <input type="submit"
name="submit" value="SubmitOrder"><input type="hidden" name="config"
value="0" />

There is apparently somthing wrong in my Javascript.

Thanks for your time.






Reply With Quote
  #4  
Old   
Kim
 
Posts: n/a

Default Re: Using an image as submit button - 09-26-2005 , 08:27 AM



"Kim" <nomail (AT) yahoo (DOT) com> wrote

Quote:
"mscir" <mscir (AT) yahoo (DOT) com> wrote in message
news:lLWdnXlRGITbrareRVn-gw (AT) pghconnect (DOT) com...
Kim wrote:

Hello
I'm trying to learn to how to use an image as a submit button.
I'm using the example found at
http://www.webdevelopersnotes.com/tips/html/21.php3

My original submit syntax:
input type="submit" name="submit" value="SubmitOrder"><input
type="hidden"
name="config" value="0" /
contains:
input type name="config" and value="0" /> that is required by my PHP
script.

Using the new Image submit syntax:
form name="orderform"><a
href="javascript:document.orderform.submit()"
onclick="return val_form_this_page()"><img src="prepay.gif" border="0"
ALT="Submit Order"></A

I can't find a place for the equivalent of <input type="hidden"
name="config" value="0" /

I have tried it in different places but it fails.

Any suggestions appreciated.

Hi Kim,

I found a good discussion of using images as submit buttons here:

http://www.cs.tut.fi/~jkorpela/forms/imagebutton.html

If you still want to use an image button to submit your form, the page
has a code example.

Read "Notes on the JavaScript surrogate" to see why it points to a
"fail.html" page.

There is also code to use to have a button rollover effect "Rollover
effects".

The hidden field can go anywhere in your form. You can place all of the
hidden fields you need anywhere in the form.

form name="orderform"
input type="hidden" name="config" value="0" /
a href="fail.html" onclick="document.myform.submit();return false;"
img alt="Submit Order" src="prepay.gif" border="0"></a
/form

Will that work for you?
Mike

Mike

I tested the <input type="hidden" name="config" value="0" /> elsewhere in
my "form", it still didn't work. I received the same "No form data has
been
sent to the script" error message.

My <input type="hidden" name="config" value="0" /> can't really go
"anywhere" in my form. The same form is sent to 2-3 different places
depending on payment method. In payment method 2, <input type="hidden"
name="config" value="1" /> is used, and so on...

Originally, this line was in two separate Submits: <input type="submit"
name="submit" value="SubmitOrder"><input type="hidden" name="config"
value="0" /

There is apparently somthing wrong in my Javascript.

Thanks for your time.

Ok Mike

I understand now, I can only have one <input type="hidden" name="config"
Quote:
value="0" /> line. I'll be using value=variable to change from 0-3.



Reply With Quote
  #5  
Old   
mscir
 
Posts: n/a

Default Re: Using an image as submit button - 09-27-2005 , 07:32 AM



Kim wrote:

<snip>
Quote:
I tested the <input type="hidden" name="config" value="0" /> elsewhere in
my "form", it still didn't work. I received the same "No form data has
been sent to the script" error message.
My <input type="hidden" name="config" value="0" /> can't really go
"anywhere" in my form. The same form is sent to 2-3 different places
depending on payment method. In payment method 2, <input type="hidden"
name="config" value="1" /> is used, and so on...
Originally, this line was in two separate Submits: <input type="submit"
name="submit" value="SubmitOrder"><input type="hidden" name="config"
value="0" /
There is apparently somthing wrong in my Javascript.
Thanks for your time.


Ok Mike

I understand now, I can only have one <input type="hidden" name="config"
value="0" /> line. I'll be using value=variable to change from 0-3.
If you were using multiple inputs with the same name, I can see how that
would cause problems. Can you use javascript to change the value of the
hidden input? Maybe something like this:

var n=3;
document.getElementById('config_input').value=n;
<input type='hidden' name='config' id='config_input' value='0'>

Mike


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.