Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:20 PM
Ice Man
Guest
 
Posts: n/a
Default Submit Form by clicking on an image

Hi all

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

Thanks


  #2  
Old July 19th, 2005, 02:20 PM
Elie Grouchko
Guest
 
Posts: n/a
Default Re: Submit Form by clicking on an image

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" <ehc00@hotmail.com> wrote in message
news:%23o5Enu9bEHA.4032@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi all
>
> How Can I submit a form by clicking on an image instead of the submit
> button?
>
> Thanks
>
>[/color]


  #3  
Old July 19th, 2005, 02:21 PM
Stuart Palmer
Guest
 
Posts: n/a
Default Re: Submit Form by clicking on an image


"Elie Grouchko" <egrouchko@hotmail.com> wrote in message
news:OIAKNl%23bEHA.2972@TK2MSFTNGP12.phx.gbl...[color=blue]
> 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>
>[/color]

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?

:o/
[color=blue]
>
> "Ice Man" <ehc00@hotmail.com> wrote in message
> news:%23o5Enu9bEHA.4032@TK2MSFTNGP11.phx.gbl...[color=green]
> > Hi all
> >
> > How Can I submit a form by clicking on an image instead of the submit
> > button?
> >
> > Thanks
> >
> >[/color]
>
>[/color]


  #4  
Old July 19th, 2005, 02:21 PM
Ice Man
Guest
 
Posts: n/a
Default Re: Submit Form by clicking on an image

I don't know actually how long but it helps a lot...


"Stuart Palmer" <stuartglenpalmer@ntlworld.com> wrote in message
news:833Mc.334$ub4.268@newsfe5-gui.ntli.net...[color=blue]
>
> "Elie Grouchko" <egrouchko@hotmail.com> wrote in message
> news:OIAKNl%23bEHA.2972@TK2MSFTNGP12.phx.gbl...[color=green]
> > 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>
> >[/color]
>
> 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?
>
> :o/
>[color=green]
> >
> > "Ice Man" <ehc00@hotmail.com> wrote in message
> > news:%23o5Enu9bEHA.4032@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > Hi all
> > >
> > > How Can I submit a form by clicking on an image instead of the submit
> > > button?
> > >
> > > Thanks
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


  #5  
Old July 19th, 2005, 02:23 PM
Bã§TãRÐ
Guest
 
Posts: n/a
Default Re: Submit Form by clicking on an image

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" <ehc00@hotmail.com>
wrote:
[color=blue]
>I don't know actually how long but it helps a lot...
>
>
>"Stuart Palmer" <stuartglenpalmer@ntlworld.com> wrote in message
>news:833Mc.334$ub4.268@newsfe5-gui.ntli.net...[color=green]
>>
>> "Elie Grouchko" <egrouchko@hotmail.com> wrote in message
>> news:OIAKNl%23bEHA.2972@TK2MSFTNGP12.phx.gbl...[color=darkred]
>> > 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>
>> >[/color]
>>
>> 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?
>>
>> :o/
>>[color=darkred]
>> >
>> > "Ice Man" <ehc00@hotmail.com> wrote in message
>> > news:%23o5Enu9bEHA.4032@TK2MSFTNGP11.phx.gbl...
>> > > Hi all
>> > >
>> > > How Can I submit a form by clicking on an image instead of the submit
>> > > button?
>> > >
>> > > Thanks
>> > >
>> > >
>> >
>> >[/color]
>>
>>[/color]
>[/color]

 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles