1

I am sorry for the vague question but I have no idea about where to start.

Please think of a scenario that, you created a video content type and you want your site visitor either upload their video files to your site, or they use the embed codes from any third party providers (youtube, vimeo etc.). For the sake of providing a clean GUI, you do not want to show both fields, but based on the choice of your user (maybe an image combo), you either show the file upload field or text area field (where they put the embed code in)

My question is, I wonder if there any elegant way to do it in Drupal without making any PHP, HTML or CSS modification?

2
  • Why this community is biased to down vote without making any comments?
    – noway
    Commented Jun 11, 2013 at 14:54
  • I'm not aware of a way to do this without any level of code. I would add both fields, and then stick some #states logic on top of the UI to only show one field.
    – Letharion
    Commented Jun 11, 2013 at 15:14

1 Answer 1

3

I have done this in the past by adding a drop down that gives the user an option of selecting "embed" or "upload" then use the Conditional fields module to show or hide the required field.

2
  • Since the conditional fields module is using the states system, this seems like a great idea. Hadn't heard of the module before. +1.
    – Letharion
    Commented Jun 11, 2013 at 15:20
  • 1
    That's excellent. Even though it is in dev branch for a long time, it works quite well as I tested in simplytest.
    – noway
    Commented Jun 11, 2013 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.