Does anyone know why Safari browser does not submit on enter key.

Discussion in 'HTML' started by zazzaron@cox.net, Dec 20, 2005.

  1. Guest

    Does anyone know why Safari browser does not submit on the enter key.

    Here's the asp page - its very simple. I click on the radio button then
    hit enter - no submit. If my focus is on a textbox all works fine.

    <HTML>
    <HEAD>
    <TITLE>enter test</TITLE>
    <script language="javascript">
    function validate()
    {

    alert('validate');
    return true;
    }
    </script>

    </HEAD>
    <form name="form1" id="form1" method="post" onSubmit="return
    validate()">
    <input type="radio" name="Amt" id="Amt">
    <font>Pay Total Amount</font>
    <input type="text" name="textfield2" size="12" >
    <input type="text" name="textfield1" size="12" >
    <input type="submit" id="xsubmit" name="xSubmit" value="Submit
    Payment">
    </form>
    </CENTER>
    </BODY>
    </HTML>
     
    , Dec 20, 2005
    #1
    1. Advertisements

  2. Edd Guest

    Re: Does anyone know why Safari browser does not submit on enterkey.

    wrote:
    > Does anyone know why Safari browser does not submit on the enter key.
    >
    > Here's the asp page - its very simple. I click on the radio button then
    > hit enter - no submit. If my focus is on a textbox all works fine.
    >
    > <HTML>
    > <HEAD>
    > <TITLE>enter test</TITLE>
    > <script language="javascript">
    > function validate()
    > {
    >
    > alert('validate');
    > return true;
    > }
    > </script>
    >
    > </HEAD>
    > <form name="form1" id="form1" method="post" onSubmit="return
    > validate()">
    > <input type="radio" name="Amt" id="Amt">
    > <font>Pay Total Amount</font>
    > <input type="text" name="textfield2" size="12" >
    > <input type="text" name="textfield1" size="12" >
    > <input type="submit" id="xsubmit" name="xSubmit" value="Submit
    > Payment">
    > </form>
    > </CENTER>
    > </BODY>
    > </HTML>
    >


    There's no action attribute on the form tag...this may be the answer.
    Put action="somescript.asp" in <form>, and set your validate function to
    return false to stop it trying to navigate there for the moment.

    Since it's a validation function, I imagine you'll want it to return
    false if there is a validation error, and return true (thus submitting
    the form) if there isn't.

    --
    Edd
     
    Edd, Dec 20, 2005
    #2
    1. Advertisements

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. Andrea Williams

    Key press "Enter" does not submit the form

    Andrea Williams, May 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    7,603
    Steve C. Orr [MVP, MCSD]
    May 24, 2004
  2. Megha Vishwanath
    Replies:
    2
    Views:
    10,315
    tutorialsmaster
    Oct 2, 2009
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,800
    Smokey Grindel
    Dec 2, 2006
  4. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    629
    Anders Matthiessen
    Jan 12, 2005
  5. M P
    Replies:
    1
    Views:
    817
  6. Guest
    Replies:
    2
    Views:
    1,846
    Guest
    Oct 25, 2004
  7. Megha Vishwanath
    Replies:
    3
    Views:
    969
    Megha Vishwanath
    Jul 20, 2004
  8. HopfZ
    Replies:
    0
    Views:
    900
    HopfZ
    Aug 28, 2006
Loading...