0
我在我的HTML
代码中具有以下表单。无法在更改选项后不刷新表单值
当我忘记填写姓, 表格会告诉我一个“泡泡消息” You have to fill in the surname
,然后我 将填补姓,按提交按钮和值提交。
当我忘了默认选项从<select>
改变形式将显示 我一个“泡泡消息” You have to choose something
,那么我会选择另一种选择, 按提交按钮,但值未提交。我总是要刷新 的页面。你知道问题出在哪里以及如何在不刷新的情况下实现它?
<form action="add" method="post">
...
<select id="choice" name="choice"
required oninvalid="setCustomValidity('You have to choose something')"
oninput="setCustomValidity('')">
<option value="" selected="selected"></option>
<option value="first">first</option>
<option value="second">second</option>
</select>
...
<input type="text" name="surname" id="surname" value=""
required oninvalid="setCustomValidity('You have to fill in the surname')"
oninput="setCustomValidity('')">
...
</form>
在我的回答在下面的提交值没有问题,这意味着您需要提供完整的代码示例。 – Timmerz 2014-11-08 18:24:15
may [this](http://stackoverflow.com/questions/26658784/php-dropdown-option-selected/26659241#26659241)帮助你? – 2014-11-08 18:25:44