bizarre event/function callback

Discussion in 'Javascript' started by tattslotto1@hotmail.com, Nov 10, 2003.

  1. Guest

    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.
    , Nov 10, 2003
    #1
    1. Advertising

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

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Nov 10, 2003
    #2
    1. Advertising

  3. Guest

    Martin Honnen <> wrote in message news:<3faf84cc$>...
    > 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.
    , Nov 11, 2003
    #3
  4. Guest

    wrote in message news:<>...
    > Martin Honnen <> wrote in message news:<3faf84cc$>...
    > > 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.
    , Nov 11, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. prettysmurfed
    Replies:
    6
    Views:
    694
    prettysmurfed
    Jul 22, 2003
  2. pvdm
    Replies:
    1
    Views:
    687
    tom_usenet
    Sep 9, 2003
  3. JDT
    Replies:
    6
    Views:
    536
    James Kanze
    Mar 29, 2007
  4. PSN
    Replies:
    1
    Views:
    271
    Puppet_Sock
    May 5, 2010
  5. me
    Replies:
    2
    Views:
    70
    A. Sinan Unur
    Feb 7, 2005
Loading...

Share This Page