如何在 drupal 7 中应用 Web 表单验证?
我的 drupal 7 网站中有网络表单。我想要的是验证我的网络表单字段。 Web 表单包含一个电话字段,该字段应接受数字字段,并且应仅包含 10 个数字。是否有任何模块可以实现此目的,或者我必须为此编写代码。
I have webforms in my drupal 7 website. What I want is to validate my webform fields. The webform contains a phone field which should accept numeric field and should contain 10 numbers only. Is there any module for this or will I have to code for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
hook_form_alter()
在 drupal 创建模块中应用自定义验证,例如 mymodule
文件 mymodule.module
如果您想了解更多如何使用
hook_form_alter()
的详细信息,请访问此链接 http://www.codeinsects.com/drupal-hook-system-part-2.htmlUse
hook_form_alter()
to apply custom validation in drupalcreate module e.g. mymodule
file mymodule.module
If you want to more to detail how to use
hook_form_alter()
visit this link http://www.codeinsects.com/drupal-hook-system-part-2.html有一个名为 Webform Validation 的模块,我们可以在其中为每个字段设置验证规则。
以下是其项目页面的摘录:
There is a module named Webform Validation where we can set validation rules for each fields.
Here is an excerpt from its project page: