bizarre event/function callback

T

tattslotto1

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.
 
M

Martin Honnen

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.
 
T

tattslotto1

Martin Honnen said:
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.
 
T

tattslotto1

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top