如何自动提交 Drupal 网络表单?

发布于 2024-10-05 03:38:40 字数 209 浏览 0 评论 0原文

我正在使用 Drupal Webform,想知道是否可以自动提交 Webform?

由于 Webform 附带 %get[key] 来通过 FORM GET URL 中的默认值填充表单字段,因此我希望用户无需单击提交按钮。可能的?谢谢!

I am using Drupal webform and wonder whether it's possible to auto-submit a Webform?

Since Webform comes with %get[key] to fill the form fields by default values from a FORM GET URL, and so I'd like to save the user a submit button click. Possible? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦毁影碎の 2024-10-12 03:38:40

您需要在 Javascript 中创建一个 Drupal 行为,应用某种逻辑来检查表单元素(即,在用户填写字段 x、y 和 z 后提交)。因为 Drupal 使用 jQuery 表单插件,所以您可以使用 ajaxSubmit 后台提交表单,或者简单地 触发表单的提交事件

You'll want to create a Drupal behavior in Javascript that applies some kind of logic to the check the form elements (i.e., submit once fields x, y, and z are filled in by the user). Because Drupal uses the jQuery form plugin, you can background submit the form with ajaxSubmit or simply trigger the form's submit event.

清旖 2024-10-12 03:38:40

要详细说明 David Eads 的答案,请使用 jQuery 而不使用 Ajax,按 Enter 键:

  jQuery('#my-form .my-form-item input')
    .keypress(function(e) {
      if (e.which == 13) {
        e.preventDefault();
        jQuery('#my-form').submit();
      }
    });

To elaborate on David Eads' answer, using jQuery without Ajax, by pressing Enter:

  jQuery('#my-form .my-form-item input')
    .keypress(function(e) {
      if (e.which == 13) {
        e.preventDefault();
        jQuery('#my-form').submit();
      }
    });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文