Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Struts 1.3.8。在我的 JSP 中有一个选择选项,其中包含动态填充的项目。 当用户没有选择任何项目时,如何对选择选项执行验证?所需的规则不起作用。有什么想法或建议吗?非常感谢您的回复,谢谢。
创建临时选项,例如
<select name="selectItem"> <option value="-1" >-----Select-----</option> . . </select>
在表单提交上调用java脚本函数检查类似的东西
if((document.Form1.selectItem[document.Form1.selectItem.selectedIndex].value)=='-1') return false; else return true;