3 users online. Create an account or sign in to join them.Users

Search

Is there a way of displaying different forms in a section after the user has selected the content type he wants to add to the database. For instance, I'd like to create a section called Articles. In this section the user would be able to create video, audio, or image-based articles. But for each type of article I need a different form. For a video article I need a title, 3 upload fields (poster, two types of video files) and a textarea where he would describe the content of the video. In the audio article I need a title, 3 upload fields (three types of audio files), and a textarea. For an image article I need a title, 1 upload field and a description. After the user selects from a pop-up menu the content type, I would like only the fields relevant to his content to be displayed. Is there an extension that would do this?

I've done exactly this more than once by creating some custom JavaScript code. You can use the Backend Add Script-extension to do this.

You still have to write some custom JavaScript-code to show/hide the correct fields on changing the value of your select-element.

As far as I know there is no extension (yet) who does this out-of-the-box, but it's not rocket science to do this on the way I described above.

Thank you for your suggestion. Unfortunately I'm not that good with Javascript. Would you mind sharing with me the code that you've used to show/hide fields?

In the past I have written an (unfinished) extension to do exactly this.

I am not really sure if it is still working, or how stable it is, but you could give it a try;)

Thanks. I've installed Dynamic Sections Editor but unfortunately it doesn't seem to work or I don't know how to use it. I get two extra checkboxes at the top of a section:

Hide this section from the Publish menu Make this a dynamic section. This will enable you to hide/show fields based on the value of another field.

Apart from checking the second option, what else would I need to do to create dynamic sections?

You could try Publish Tabs, to split up fields into their own tabs. You'd still need to decide which to make required though, as all the fields will still be in the same section, but at least you can break them up visually.

The alternative is to use separate sections for each article type, although this will make fetching them later on a bit harder.

@ovidiust: indeed, the extension will add a checkbox (Make this a dynamic section) to your section editor. The other checkbox is already there ;)

Now, if you check that checkbox, you will see an added checkbox to each of your fields: "Show/hide this field based on the value of another field."

If you check that checkbox, you are given the options to show / hide based on the value of another field.

Does that clarify things a bit?

Edit: I have made a few changes to the extension just now to make it work in later versions of symphony, too. The latest changes are on github, so please pull before giving it a try.

Thank you guys for your help. I've opted in the end for the Dynamic Section Editor. It looks good and quite reliable. The only thing I struggle is to show or hide a field depending on whether a checkbox is checked or not. Any ideas?

Thank you Nick for suggesting Publish Tabs as well. I will be using it for some other sections.

Oof, I can't really remember my choice for checkboxes.. Have you tried yes or no? If these do not work , you might want to try true and false.

Good to hear you found it useful, though!

yes with lowercase, works. Thank you.

creativedutchman, Just wondering if you are planning to continue work on this extension and release it. It's something I find very useful and would be great to know that it could be used for a production site. I've been looking through all the extensions and there really isn't anything like it.

Thanks

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details