Forum

Thread tagged as: Discussion

NEW v3.1 Field Groups

I don't know if you want just one thread for all things "Field Groups" or separate threads. Either way, I've given it a quick go and have an observation/question:

Using a Field Group around 'standard' fieldtypes works exactly as you described. However, I also tried using a Group around some custom fieldtypes and the Group UI ignored the custom fieldtypes, instead wrapping itself around the first available standard fieldtype above the custom fieldtypes.

If for the moment it only works around standard fieldtypes, that's fine.

A very small thing with the UI - I can't click on the rotating arrow/circle image to collapse the Group. Clicking the title text bar (expanded) or the body (collapsed) works fine - my first instinct was to try clicking the (small) image! This was on Chrome version new-ish-something-or-other.

Duncan Revell

Duncan Revell 78 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It should work for any field type, although you'll need to implement support for the content summary in collapsed mode.

Does your field appear in more than one place in the template?

Duncan Revell

Duncan Revell 78 points
Registered Developer

Yes, it appears in more than one place.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the first instance in the group, or a secondary instance?

Duncan Revell

Duncan Revell 78 points
Registered Developer

I originally tried around secondary instances, then tried a group around the first few instances, and I've just tried the group around the first instance only - same result; it shuffles up to the first available standard fieldtype.

Duncan Revell

Duncan Revell 78 points
Registered Developer

As a visual aid, it looks like this currently: (this is used as a master template for collection items, so there is no html, just Perch fields)

Date field
Text field
Radio field
Text field
Text field
Category
---Divider---
Custom field (x15)
---Divider---
Custom field (x8)

The custom fields are all the same type.

I originally 'replaced' the dividers with groups - it always ends up wrapped around the Category field.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you duplicate the template, swap the custom fieldtypes for basic type="text" and then use it on a new test region, does that change anything?

I'm trying to understand if it's a quirk of the template or of the field type.

Duncan Revell

Duncan Revell 78 points
Registered Developer

I think I've stumbled across the answer - doing as above (I created a new collection, just to be sure it was as near identical as possible), changing type to "text": same problem.

My custom fieldtype has some attributes I use - one of which is filterid="season" (and of course, season is the name of the category field that the group ends up surrounding). When I started removing the attributes, as soon as I removed filterid, the group worked correctly. Have I stumbled across a variable/attribute name in your code that I'm inadvertently messing with? As soon as I rename my attribute to something else, the problem also goes away...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Huh. That is interesting. There shouldn’t be any clashes in attribute naming, but it’s not outside the realm of possibility. I’ll give it a try and see if I can reproduce that.

Duncan Revell

Duncan Revell 78 points
Registered Developer

No probs - just as a quick test, I added filterid="someid" to a standard text field (nothing to do with my custom fieldtype) and the same thing happens - so no need to test against anything custom.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Really weird! I'll see if I can reproduce it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

An overly greedy regex capturing the id="someid" at the end of filterid="someid". Should be fixed in 3.1.1.