开发者

Drupal dynamic field type toggle

I have a form field in Drupal which I need some help with.

The requirement is to have the field show up as a simple input field, but to have a toggle button against it which would convert it into a multi-line text box for users who wish to enter more data.

In traditional PHP/HTML/Javascript this would be dead easy 开发者_Python百科-- two fields; one styled with visibility:hidden; and a short js function on a button to toggle the visibility style of the two fields.

But I can't see how to translate this concept into the Drupal forms API. Can anyone help?

I'm experienced with PHP but an absolute beginner with Drupal, by the way. I'm still feeling my way around it, so please bear with me if I've asked something really obvious.


I solved this one myself. Now that I know Drupal a bit better, it's actually pretty simple (I can see why no-one bothered to answer). In the end I was able to use a pretty similar technique to the traditional methods I mentioned in the question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜