表单对字段进行验证

时间:2016-02-12 14:19:22

标签: forms validation

我有一个html表单,其中包含一对项目/小时字段(项目是选择字段和小时输入字段),我需要在我的表单中验证。这些对中大约有5对。当下列情况之一发生时,我希望用户收到错误提交的通知:没有项目选择和任何一对填充小时;当选择项目但没有为该项目定义小时时,反之亦然。 我如何才能在一对中验证我的字段?

1 个答案:

答案 0 :(得分:0)

Assuming a button is clicked by the user when the user thinks he is finished, you can check the selects and inputs with Jquery. If something is not ok, then tell the user and prevent the button from doing anything else.

相关问题