在非CCK Drupal表单中添加另一个项目 [英] 'add another item' in non-CCK Drupal forms

查看:96
本文介绍了在非CCK Drupal表单中添加另一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CCK for Drupal具有方便的功能,允许单个CCK字段通过添加另一个项目按钮接受多个值,从而导致节点中的数据数组。

CCK for Drupal has the handy feature of allowing a single CCK field to accept multiple values via a "add another item" button that results in an array of data in the node.

我想知道是否有一个简单的方法来适应非CCK表单,我将通过 drupal_get_form 调用。我不想用多步法形式重新发明轮。

I'm wondering if there's any easy way of adapting this for a non-CCK form that I'd be calling by drupal_get_form. I'd rather not have to re-invent the wheel with multi-step form techniques.

任何人都这样做?

推荐答案

如果他们包含了一个更简单的例子,那将是很好的,但 Drupal中的AHAH简介,以及这篇关于使用AHAH添加动态表单元素的文章应该涵盖几乎所有你需要的(不幸的是,这是相当多的)。

It would be nice if they had included a more reduced example, but this Introduction to AHAH in Drupal, along with this post on adding dynamic form elements using AHAH should cover pretty much all you need (which, unfortunately, is quite a bit).

CCK这样做的方式(主要在 content_add_more_js )在content.node_form.inc)有点更复杂,因为他们需要满足不同字段类型的泛化,以及添加一些额外的东西,以允许平滑的tableort拖放功能。所以除非你需要后者,否则我宁可不用它作为例子,因为它有点混乱;)

The way CCK does this (mainly in content_add_more_js() in content.node_form.inc) is a bit more convoluted, as they need to cater for the generalization for different field types, as well as adding some extra stuff to allow for smooth tablesort Drag&Drop functionality. So unless you need the latter, I'd rather not use it as an example, as it gets a bit confusing ;)

这篇关于在非CCK Drupal表单中添加另一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆