在Drupal中为同一个字段使用多个表单字段小部件 [英] Using multiple form field widgets for the same field in Drupal

查看:163
本文介绍了在Drupal中为同一个字段使用多个表单字段小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想能够为同一个字段使用多个表单字段窗口小部件,并且能够根据用户的会话数据进行切换。但我不太确定如何完成这个。这是Drupal 6.任何关于如何实现这个的想法?

I would like to be able to use multiple form field widgets for the same field and to be able to switch it based on session data from the user. But I am not really sure how to accomplish this. This is for Drupal 6. Any ideas on how to accomplish this?

推荐答案

我最后做的是创建一个第二个表单域它使用文件夹上传小部件,并将其加载到Flash小部件旁边的表单上。然后我将JS放在页面上,以检测Flash是否在页面上,并且是正确的版本。如果发现它隐藏了html / AJAX上传器。如果不是,它会隐藏Flash上​​传器。

What I ended up doing was creating a second form field that uses the filefield upload widget and loaded it on the form alongside the Flash widget. Then I put JS on the page that detects if Flash is on the page and is of the correct version. If it is found then it hides the html/AJAX uploader. If it is not then it hides the Flash uploader.

这篇关于在Drupal中为同一个字段使用多个表单字段小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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