Drupal 7 中表单验证失败时清除表单输入
我在表单验证失败后无法清除表单输入。
例如,如果表单中存在任何单选按钮元素(其中有两组且未选中),则表单验证功能将引发错误。如果用户选择第一组,但没有选择第二组,则会引发错误。我想知道如何清除表单输入,以便清除组 1 中先前选择的单选按钮。
这是通过 Drupal 7 完成的。
I am having trouble clearing the form input upon failed validation of the form.
For example the form validation function would throw an error if there is a there is any radio button element in the form, of which there is two groups, left unchecked. If the user select the first group, but does not select for the second group, an error is thrown. I would like to know how I can clear the form input such that the previously selected radio button in group 1 is cleared.
This is being done with Drupal 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要添加一个验证函数来清理 form_state...
You'll need to add a validate function that cleans the form_state...