Connecting Tech Pros Worldwide Forums | Help | Site Map

bizarre event/function callback

tattslotto1@hotmail.com
Guest
 
Posts: n/a
#1: Jul 20 '05
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.

tattslotto1@hotmail.com
Guest
 
Posts: n/a
#2: Jul 20 '05

re: bizarre event/function callback


Martin Honnen <mahotrash@yahoo.de> wrote in message news:<3faf84cc$1@olaf.komtel.net>...[color=blue]
> tattslotto1@hotmail.com wrote:[color=green]
> > 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?[/color]
>
> 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.[/color]

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.
tattslotto1@hotmail.com
Guest
 
Posts: n/a
#3: Jul 20 '05

re: bizarre event/function callback


tattslotto1@hotmail.com wrote in message news:<93c77f62.0311101832.650f647b@posting.google. com>...[color=blue]
> Martin Honnen <mahotrash@yahoo.de> wrote in message news:<3faf84cc$1@olaf.komtel.net>...[color=green]
> > tattslotto1@hotmail.com wrote:[color=darkred]
> > > 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?[/color]
> >
> > 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.[/color]
>
> 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.[/color]

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.
Closed Thread