By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,317 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,317 IT Pros & Developers. It's quick & easy.

bizarre event/function callback

P: n/a
Hi,

I'm am newbie trying to learn javascript/forms/php and I've
encountered this problem under gecko based browsers (mozilla, ns7).

basically I have this page which contains a form which is partly
generated by php code.

the form code is

<form onsubmit="return savedata();" name="frmLoc" method="POST"
enctype="multipart/form-data"
action="/locations.php">

The following is php generated with 41 being the record id:

<input type="image" align="middle" alt="Delete this record"
src="images/cancel.gif" onclick="return verifyDelete('41');">

and at the end of the form code I have
<input type="text" tabindex=1 name="txtLocation">

Now the problem is that when I press Enter at the txtLocation field,
on gecko browsers, I get the verifyDelete function called as if I have
clicked on the input image control. The strange thing is that it is
always the event for the first record that is being launched.

This doesnt happen under ie6 or Konqueror. The javascript console does
not show any messages at all.

Any ideas what I am doing wrong?

Thanks

T.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Martin Honnen <ma*******@yahoo.de> wrote in message news:<3f********@olaf.komtel.net>...
ta*********@hotmail.com wrote:
I'm am newbie trying to learn javascript/forms/php and I've
encountered this problem under gecko based browsers (mozilla, ns7).

basically I have this page which contains a form which is partly
generated by php code.

the form code is

<form onsubmit="return savedata();" name="frmLoc" method="POST"
enctype="multipart/form-data"
action="/locations.php">

The following is php generated with 41 being the record id:

<input type="image" align="middle" alt="Delete this record"
src="images/cancel.gif" onclick="return verifyDelete('41');">

and at the end of the form code I have
<input type="text" tabindex=1 name="txtLocation">

Now the problem is that when I press Enter at the txtLocation field,
on gecko browsers, I get the verifyDelete function called as if I have
clicked on the input image control. The strange thing is that it is
always the event for the first record that is being launched.

This doesnt happen under ie6 or Konqueror. The javascript console does
not show any messages at all.

Any ideas what I am doing wrong?


I think you have run into a bug with Mozilla, I have filed
http://bugzilla.mozilla.org/show_bug.cgi?id=225214
Opera 7 exhibits a similar behaviour however.


Thanks Martin. I was pulling my hair out trying to figure it out :-)

The bug status is currently set to resolved. The recommended solution
is that I replace <input type="text" name="inputName" tabindex="1">
with
<input type="submit" name="inputName" tabindex="1">

I already have a submit button. I dont need a second.

Cheers,

T.
Jul 20 '05 #2

P: n/a
ta*********@hotmail.com wrote in message news:<93**************************@posting.google. com>...
Martin Honnen <ma*******@yahoo.de> wrote in message news:<3f********@olaf.komtel.net>...
ta*********@hotmail.com wrote:
I'm am newbie trying to learn javascript/forms/php and I've
encountered this problem under gecko based browsers (mozilla, ns7).

basically I have this page which contains a form which is partly
generated by php code.

the form code is

<form onsubmit="return savedata();" name="frmLoc" method="POST"
enctype="multipart/form-data"
action="/locations.php">

The following is php generated with 41 being the record id:

<input type="image" align="middle" alt="Delete this record"
src="images/cancel.gif" onclick="return verifyDelete('41');">

and at the end of the form code I have
<input type="text" tabindex=1 name="txtLocation">

Now the problem is that when I press Enter at the txtLocation field,
on gecko browsers, I get the verifyDelete function called as if I have
clicked on the input image control. The strange thing is that it is
always the event for the first record that is being launched.

This doesnt happen under ie6 or Konqueror. The javascript console does
not show any messages at all.

Any ideas what I am doing wrong?


I think you have run into a bug with Mozilla, I have filed
http://bugzilla.mozilla.org/show_bug.cgi?id=225214
Opera 7 exhibits a similar behaviour however.


Thanks Martin. I was pulling my hair out trying to figure it out :-)

The bug status is currently set to resolved. The recommended solution
is that I replace <input type="text" name="inputName" tabindex="1">
with
<input type="submit" name="inputName" tabindex="1">

I already have a submit button. I dont need a second.

Cheers,

T.


Read the related bugs reports and comments and seems like this is the
'expected' behaviour for gecko browsers. I changed the

<input type="image"

to

<img ... onclick="

and all is well.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.