Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Submit Form by clicking on an image

Reply
Thread Tools

Submit Form by clicking on an image

 
 
Ice Man
Guest
Posts: n/a
 
      07-22-2004
Hi all

How Can I submit a form by clicking on an image instead of the submit
button?

Thanks


 
Reply With Quote
 
 
 
 
Elie Grouchko
Guest
Posts: n/a
 
      07-22-2004
Use JavaScript code that will submit the form as a result of the click
event:

<html>
<head>

<script type="text/javascript">
function SubmitForm()
{
document.getElementById("form1").submit();
}
</script>

</head>
<body>

<form id="form1" action="page2.htm" method="post">

<img src="" onclick="SubmitForm()">

</form>

</body>


"Ice Man" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi all
>
> How Can I submit a form by clicking on an image instead of the submit
> button?
>
> Thanks
>
>



 
Reply With Quote
 
 
 
 
Stuart Palmer
Guest
Posts: n/a
 
      07-23-2004

"Elie Grouchko" <(E-Mail Removed)> wrote in message
news:OIAKNl%(E-Mail Removed)...
> Use JavaScript code that will submit the form as a result of the click
> event:
>
> <html>
> <head>
>
> <script type="text/javascript">
> function SubmitForm()
> {
> document.getElementById("form1").submit();
> }
> </script>
>
> </head>
> <body>
>
> <form id="form1" action="page2.htm" method="post">
>
> <img src="" onclick="SubmitForm()">
>
> </form>
>
> </body>
>


Why don't you just use:

<input type="image" src="image.jpg" alt="Submit" height="50" width="50" />

Then the form will submit for JS user and non JS users alike.....BTW, how
long has ASP been clientsize javascript?

/

>
> "Ice Man" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi all
> >
> > How Can I submit a form by clicking on an image instead of the submit
> > button?
> >
> > Thanks
> >
> >

>
>



 
Reply With Quote
 
Ice Man
Guest
Posts: n/a
 
      07-23-2004
I don't know actually how long but it helps a lot...


"Stuart Palmer" <(E-Mail Removed)> wrote in message
news:833Mc.334$(E-Mail Removed)...
>
> "Elie Grouchko" <(E-Mail Removed)> wrote in message
> news:OIAKNl%(E-Mail Removed)...
> > Use JavaScript code that will submit the form as a result of the click
> > event:
> >
> > <html>
> > <head>
> >
> > <script type="text/javascript">
> > function SubmitForm()
> > {
> > document.getElementById("form1").submit();
> > }
> > </script>
> >
> > </head>
> > <body>
> >
> > <form id="form1" action="page2.htm" method="post">
> >
> > <img src="" onclick="SubmitForm()">
> >
> > </form>
> >
> > </body>
> >

>
> Why don't you just use:
>
> <input type="image" src="image.jpg" alt="Submit" height="50" width="50" />
>
> Then the form will submit for JS user and non JS users alike.....BTW, how
> long has ASP been clientsize javascript?
>
> /
>
> >
> > "Ice Man" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > Hi all
> > >
> > > How Can I submit a form by clicking on an image instead of the submit
> > > button?
> > >
> > > Thanks
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
BTR
Guest
Posts: n/a
 
      07-27-2004
The image actually works like a submit button when using

<input type="image" name="subButton" src="image.jpg" alt="Submit"
height="50" width="50" />

getting the value from the submit button is
request.form("subButton.x") OR
request.form("subButton.y")

Because the button is an image - you are esentially testing to see if
the x,y value (height, width) is greater than 0

Hope this help
- Bastard


On Fri, 23 Jul 2004 17:25:24 +0200, "Ice Man" <(E-Mail Removed)>
wrote:

>I don't know actually how long but it helps a lot...
>
>
>"Stuart Palmer" <(E-Mail Removed)> wrote in message
>news:833Mc.334$(E-Mail Removed)...
>>
>> "Elie Grouchko" <(E-Mail Removed)> wrote in message
>> news:OIAKNl%(E-Mail Removed)...
>> > Use JavaScript code that will submit the form as a result of the click
>> > event:
>> >
>> > <html>
>> > <head>
>> >
>> > <script type="text/javascript">
>> > function SubmitForm()
>> > {
>> > document.getElementById("form1").submit();
>> > }
>> > </script>
>> >
>> > </head>
>> > <body>
>> >
>> > <form id="form1" action="page2.htm" method="post">
>> >
>> > <img src="" onclick="SubmitForm()">
>> >
>> > </form>
>> >
>> > </body>
>> >

>>
>> Why don't you just use:
>>
>> <input type="image" src="image.jpg" alt="Submit" height="50" width="50" />
>>
>> Then the form will submit for JS user and non JS users alike.....BTW, how
>> long has ASP been clientsize javascript?
>>
>> /
>>
>> >
>> > "Ice Man" <(E-Mail Removed)> wrote in message
>> > news:%(E-Mail Removed)...
>> > > Hi all
>> > >
>> > > How Can I submit a form by clicking on an image instead of the submit
>> > > button?
>> > >
>> > > Thanks
>> > >
>> > >
>> >
>> >

>>
>>

>


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert form to submit on load instead of clicking submit button? Network-Man HTML 5 07-07-2012 12:06 PM
submit 1 form to 2 servers or 2 forms to 2 server (1 form each) on 1 submit abansal.itp@gmail.com Javascript 3 06-23-2007 07:29 AM
javascript submit() function performs differently from clicking submit ljlolel Javascript 2 05-18-2006 04:35 PM
submit the form by clicking the button only. jrefactors@hotmail.com HTML 1 12-23-2004 06:50 PM
Submitting a form without clicking submit Fox ASP General 2 09-10-2003 05:51 PM



Advertisments