禁用表单后按下输入

时间:2014-04-10 15:15:49

标签: javascript php forms post autocomplete

您好我有一个自动完成事件工作,按回车键。但它在一个表单中是如何禁用表单方法的按下输入事件?

这是我的代码

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

1 个答案:

答案 0 :(得分:1)

您可以使用jQuery来禁用它

base.keypress(function(e) {
var code = e.keyCode || e.which;
if(code == 13)
    return false;
});