关闭基于查询字符串值的必填字段验证?
我有一张大约有 30 个字段的注册表(是的..我知道..疯狂)。我需要某些类型的人需要其中一些字段。我想做的只是使用像 example.com/user/register/?type=notrequired 这样的查询字符串。如果 type = notrequired 那么我想使这些字段成为不需要的。这可能吗?我尝试使用 jQuery Validate 插件,但它不起作用。我认为内置的 Drupal 验证与其冲突:(
I have a registration form with about 30 fields (yes.. I know.. insanity). I need some of these fields to be required by certain types of people. What I'd like to do is just use a query string like example.com/user/register/?type=notrequired. If type = notrequired then I'd like to make to make the fields not required. Is this possible? I tried using the jQuery Validate plugin but its not working.. I'm thinking the built in Drupal validation is conflicting with it :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
required
标志是在服务器端设置的,所以我怀疑您是否能够使用 JavaScript 来影响它。您必须连接到表单并在 PHP 中进行更改,在自定义模块中类似这样:希望有帮助
The
required
flag is set server side so I doubt you'll be able to affect it using javascript. You'll have to hook into the form and make the changes in PHP, something like this in a custom module:Hope that helps