0

Hello I have a autocomplete event work with press enter. But it's in a form so how disable the press enter event for the form method?

Here my code

<tr> <td> <form action = 'insert.php' method="post" onsubmit="return false;" > <p> <td> <input type="text" name="client7" class = "client" size="12" id ="client7" readonly /> </td> <td> <!-- dꣵt section cobobox tache avec tool tip --> <label title="Select your state"> <select title="Select your state" id="state" name="state"> <?php $stmt->execute(); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { echo ' <option title="'; echo $row['tacName']; echo '">'; echo $row['tacId']; echo '</option>'."\n"; $task = array(); } ?> </select> </label> <!-- Fin section cobobox tache avec tool tip --> </td> <td> <span id="calculTemps6"> <input id="input7" class= "temps" type="number" size="2" min="0" max="24" value="0"></br> </span> </td> </tr> <input type="text" id="result" readonly="readonly" name="total" /> <input type="submit" value="Terminé" id="end" /> <input type="hidden" name="data" value="<?php echo $date; ?>" /> </p> </form> </td> </td> 
4
  • 1
    This has been answered numerous times stackoverflow.com/questions/10313032/… Commented Apr 10, 2014 at 15:17
  • Can you please format your code.. Commented Apr 10, 2014 at 15:17
  • Sidenote: Using jQuery is only effective if JS is enabled. Commented Apr 10, 2014 at 15:25
  • both won't work for my case Commented Apr 10, 2014 at 15:30

1 Answer 1

1

You can use jQuery to disable it

base.keypress(function(e) { var code = e.keyCode || e.which; if(code == 13) return false; }); 
Sign up to request clarification or add additional context in comments.

5 Comments

how do I link it to my form post?
Just include it in the head of the page as you would with javascript. jquery.com
won't work and yes the script is in the top of my page witch my other function
Are you including the jQuery library?
yes code<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.