473,378 Members | 1,360 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Image button acting like submit button.

I have a web page that i am using an image button as my submit button. The
code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as
the default button on the form?

Thanks in advance
Russell
Nov 18 '05 #1
3 5420
Russell,

I've had this problem before too and, to my knowledge at least, there is no
direct way to achieve this. Instead what I did was provide a handler for
the text box that handles the enter key. If the handler gets called, it
just forwards the processing to the image button's submit handler. This
solution isn't exactly the most elegant way, but it works.

Eric
"Russell" <la******@comcast.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
I have a web page that i am using an image button as my submit button. The
code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as
the default button on the form?

Thanks in advance
Russell

Nov 18 '05 #2
You can intercept the client side enter keypress event of the text box and
then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/show...d=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/20...200406so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Russell" <la******@comcast.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
I have a web page that i am using an image button as my submit button. The
code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as
the default button on the form?

Thanks in advance
Russell

Nov 18 '05 #3
It's very strange that in my project, they automatically act as a submit
button, so I have to add a (X,Y) = (0,0) checker in the click handler
routine just to skip when "enter" is pressed in the textbox.

Perheps there are more than one ImageButton in your form so the browser got
it mixed up.

"Eric Cherng" <ericch1@remove_the_dot-hotmai.l.com> ¦b¶l¥ó
news:%2***************@tk2msftngp13.phx.gbl ¤¤¼¶¼g...
Russell,

I've had this problem before too and, to my knowledge at least, there is no direct way to achieve this. Instead what I did was provide a handler for
the text box that handles the enter key. If the handler gets called, it
just forwards the processing to the image button's submit handler. This
solution isn't exactly the most elegant way, but it works.

Eric
"Russell" <la******@comcast.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
I have a web page that i am using an image button as my submit button. The code behind the button works, but when I click enter on the web page,
nothing happens. Can anybody tell me how to get my image button to act as the default button on the form?

Thanks in advance
Russell


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicolas Keller | last post by:
Hi! I'm used to have Mozilla for testing my PHP sites when I'm coding. The site's nearly finished, now I've made a test with the Internet Exlporer... guess what... failed. The problem: I'm...
4
by: Ice Man | last post by:
Hi all How Can I submit a form by clicking on an image instead of the submit button? Thanks
6
by: Marek Mänd | last post by:
Can the <button><img></button> mutated via CSS so, that the inner image of <BUTTON> would entirely visually become the button itsself - I mean without the outer elements borders and so... ...
2
by: Matt | last post by:
In the following code, I have 2 questions regarding submit button with image. 1) Does this code <input type="image" name="populate" src="populate.gif"> behave the same as an HTML submit button...
1
by: Phil_Cam | last post by:
Hello All On a webpage I have a standard paypal image button for purchases. I am trying to set it up so that it only shows up or is endabled when text is entered into a textbox and a button is...
2
by: Bundy | last post by:
Hi On my webpages I have replaced the submit button with a rolling submit button using the script below (Script 1). This script is used by many of my webpages and is included in a external...
16
by: browntown | last post by:
so I have this application I'm nearly finished with. The only thing the client has requested is the ability to submit the form by pressing "enter". I didn't think this would be a huge pain in the...
2
by: Poppa Pimp | last post by:
ImageResizer.php Image Resizer PLEASE HELP The URL of the page this is on in my site is http://poppa-pimps-wallpapers.com//ImageResizer.php You can click on browse and get image,but...
2
by: Tim Streater | last post by:
The following test page is intended to allow the user to choose an image file, and then display it. It works as expected in Safari 3.1.1, FF 2.0.0.14 (Mac), and IE7 (XP). But, it fails in FF...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.