Multiple Express Forms for the same Entity (or categories?)

Permalink
Hi there,

I checked out Version 8 and immediately realized the power of the new Express feature. However, I find one particular thing very annoying or I am too stupid to use it correctly. For each Express Object I can apparently create multiple forms with a different selection of attributes. This is very handy. However, I don't see any possibility to select the form to be used if a new Express Object is added or one is edited. It always uses the standard form (which can be chosen in the settings).

To explain why I would like to do that I use the same example as Andrew in his Express introduction video. There are boats that belong to a Marina with different attributes such as name and length. Let's now suppose that we have boats of different types, such as sailing boat, rowing boat and motor yacht. I would now like to have a different set of attributes for each boat type. E.g. the sailing boat should have an attribute sail area, while the motor yacht features an attribute engine output, which are unique to this boat type.

Of course I could create three different entities, but that's not what I want as they should be listed by the same express list block.

Is there any way to do that? If not, please regard this as a feature request.

simpit
 
Gondwana replied on at Permalink Reply
Gondwana
I don't know the answer, but I love the question. Methinks the underlying issue is that you're interpreting your data in a partially object-based way, like PostgreSQL. I suspect that the underlying structure used within c5 is just a normal relational model, so it won't be easily able to accommodate polymorphism.
andrew replied on at Permalink Reply
andrew
If you edit an express object in the Dashboard > System > Data Objects section you'll be able to choose which form to use for adding vs editing, which might get you part of the way there. Otherwise there's really no way through the user interface at the moment. It's definitely something that I think would be useful to have, which is why we built it with that flexibility in mind even if there isn't a way to use it quite yet.

You can have a different form on the front-end, however – if you set up a front-end Form block (which uses Express) you can then create different forms and use those forms on the backend. You can also use these forms through custom code pretty easily (if you create your own dashboard pages) which is something I will be doing a video about fairly soon.
simpit replied on at Permalink Reply
simpit
@Gondwana: I think you're right, I'm trying to create an object-based structure here. Maybe I should uncover what I'm really trying to accomplish here. I'm currently working on a designer's new webpage, who has created a very cool design which resembles more a slideshow than a webpage, though.
For such purposes I've been misusing the Page List Block to bundle attributes per (Slide/Page) for years now which is, however, pretty awkward because there is no actual page (only the attributes are used in this case). It was a fairly large challenge to explain that to the end-users :-D. The express functionality now finally puts an end to that 'issue'. Now, if I build these slideshows with express I have slides of different types (e.g. title slide, project slide, screenshot slide) with different sets of attributes (e.g. text, title, link, background image, background color and so on). My initial plan to achieve this is to add the whole set of attributes to the slide (say 15) and then have different forms for the different slide types which only feature the specific attributes for this particular slide (say 5, the rest are just empty).

@andrew: first of all a little praise to you guys. I've been working on various CMS (like WordPress or Joomla) over the years and I must say, C5 is cutting edge! +1 for you guys!

I've been sweeping through the core code quickly and I think it should be doable. I'd suggest adding an option 'choose form via popup' and then load a list of the different forms instead of returning the standard form. Or even more badass would be the possibility to automatically output a form according to a select attribute (in my case: slide category).

Another feature that would be extremely handy would be a sitemap-like overview, drag-and-drop sorting-style thing for express objects (tree of slideshows > slides). With the custom sorting possibility you definitely went into this direction already. Namely in this case the ugly Page-List workaround is still one step ahead when it comes to usability. I strongly suspect that many people want to build similar structures like this one in my current project.

Ok! Thanks... I thought about that already, actually. However, I didn't figure out how to output a specific form of a certain entry programmatically. Could you paste me the code for your 'add Boat' menu entry that was seen in the video but not mentioned?

Cheers,
Mario
Gondwana replied on at Permalink Reply
Gondwana
Maximum flexibility could be provided via an API function/override that allows a developer-provided function to return the desired form type. It would be up to the developer to work out how to map express data to form types, and code that in php.
simpit replied on at Permalink Reply
simpit
Agreed! That sounds like a very good solution!
hereNT replied on at Permalink Reply
hereNT
Personally, I'd rather be able to simply control the individual forms in more detailed ways. Instead of swapping out a whole form, I'd rather have a way to have select menus or checkboxes toggle other fields. Not sure what the best way is to do that, though. I know some of the form builder addons have been able to do this, where there are ways to specify rules about when a field displays conditionally.
simpit replied on at Permalink Reply
simpit
Correct! However, if you do it that way I don't see a particular reason of having the possibility to specify multiple forms for one Express Entity