具有 CCK 内容类型的 Drupal WebForm。对于匿名用户

发布于 2024-10-18 21:18:37 字数 933 浏览 1 评论 0原文

我可能在问一个菜鸟问题...但是:

我有一个 Drupal 网站,客户有一个网络表单,匿名用户可以填写其中以订购一些海报(有 3 个可供选择)。这些都是免费的,目前他们的用户只需在文本区域的正文中说明他们想要什么海报。

网站所有者现在希望添加更多海报,并且现在希望能够在 Web 表单中列出每张海报,并在其旁边添加一个数量字段。

提交网络后,它将把节点标题和数量以及所需信息一起发布到网络表单中。

我研究过使用统一通信,但对于如此简单的需求来说,它太过于是一种电子商务解决方案。我还查看了 SimpleCart、Flag 和 Session 最喜欢的,所有这些都不是我真正需要的。

因此,我正在寻找一种简单的方法来遍历所有“海报”内容类型,并将它们显示在网络表单页面上,并在每个海报的网络表单中提交一个数量数字字段。

目前我有:

CCK 海报

  • 标题
  • 图片

WebForm OrderPoster

  • 姓名
  • 电子邮件
  • 地址
  • 详细信息

我正在寻找的是执行以下操作的页面:

WebForm OrderPosters:

  • 海报 1 [表单数量文本输入海报 1]
  • 海报 2 [形成海报 2 的数量文本输入]
  • 海报 3 [形成海报 3 的数量文本输入]
  • ...
  • 海报 n [形成海报 n 的数量文本输入]

  • 姓名

  • 电子邮件
  • 地址
  • 详细信息

我想有一个简单的方法可以做到这一点,但我似乎找不到自定义“WebForm”表单的文章。任何帮助将不胜感激。

I am probably asking a noob question... however:

I have a Drupal site that the customer has a web form where anonymous users can fill in to order some posters (there is 3 to choose from). These are free and at the moment they user just states in the body of a textarea what posters they want.

The site owner wants to now add more posters and now wants the ability to have each poster listed in the web form with a field for quantity next to them.

When the web for is submitted it will post the node title and quantity to the web form along with the required information.

I have researched using UC but it's too much of a eCom solution for such a simple requirement. I also looked at SimpleCart, Flag and Session favorites, all of which aren't really what I need.

So I am looking for a simple way to itterate over all the "Poster" content types, and display them on the webform page with a quantity numerical field to be submitted with the web form for each poster.

Currently I have:

CCK Poster

  • Title
  • Image

WebForm OrderPoster

  • Name
  • Email
  • Address
  • Details

What I am looking for is a page that does the following:

WebForm OrderPosters:

  • Poster 1 [form qty text input for poster 1]
  • Poster 2 [form qty text input for poster 2]
  • Poster 3 [form qty text input for poster 3]
  • ...
  • Poster n [form qty text input for posters n]

  • Name

  • Email
  • Address
  • Details

I'd imagine there is a simple way to do this, but I can't seem to find articles of customizing "WebForm" forms. Any help would be much appreciated.

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

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

发布评论

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

评论(1

怪我闹别瞎闹 2024-10-25 21:18:37

我不知道有什么方法可以以编程方式将组件添加到网络表单中。我在我的网站中经常使用它们,但是如果您打算执行您所说的操作,则必须采用自定义模块路线。如果您确实想保留网络表单,您可以编写自己的表单组件来完全执行您想要的操作,但文档也很少。我会首先查看一些内置组件,以了解需要做什么,然后制作自己的组件。

就我个人而言,我会实现一个自定义模块来执行此操作。您需要使用 hook_menu(),然后创建一个回调来构建此表单。在构建表单时,您可以轻松地循环浏览可用的海报并创建表单元素。然后,提交功能将保存到数据库表中,如果需要,当您的客户希望人们为海报付款时,它还可以发布到支付网关。

I don't know of any way to programmatically add components to a webform. I've used them a lot in my sites, but if you are going to do something like what you said you have to go the custom module route. If you did want to keep the webform you could program your own form component to do exactly what you want, but docs are scarce for that too. I would start by looking at some of the built-in components to get an idea of what needs to be done and then make my own.

Personally I would implement a custom module to do this. You would need to use hook_menu() and then create a callback to build this form. While building the form you could easily loop through the available posters and create the form elements. The submit function would then save to a database table and if needed, it could also post to a payment gateway when your customer wants people to pay for the posters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文