Skip Navigation

[Resolved] Sorting repeating fields alphabetically

This support ticket is created 5 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 2 voices.

Last updated by Christian Cox 5 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#1129928
Screen Shot 2018-10-18 at 8.32.32 AM.png
Screen Shot 2018-10-18 at 8.32.22 AM.png

Tell us what you are trying to do?
I have a list of values from a large field of checkboxes in a form. I store whatever the user checks as a repeating field for each question that they're asked to answer. When I display the results, it shows the fields in the order that the user checked them based on their position in the form. I'm applying CSS to colorize the results and would like to group them, which I think I can accommodate using an ASC sort order. I've added a letter at the beginning of each skill so I can at least group them, thereby simulating grouping the colors together.

Is there a way that this can be done?

#1130056

Hi, the Types checkboxes field shortcode doesn't provide any options for specifying a custom sort order, so you're limited to the order of the checkbox options in the Custom Field Group editor. If you'd like to customize this field output, it would require custom code that falls outside the scope of support we provide here. We have a contractors portal available where you can connect with skilled independent developers who may be able to provide professional assistance: https://toolset.com/contractors

#1130092

Thanks for the reply, Christian. I'm actually not using the checkbox field as far as Toolset goes. I'm using this in conjunction with GravityForms and am relaying the value assigned to the checkbox (which is really a custom field placeholder in GF) and passing the value to a repeating single line text field as far as the custom field goes. Does that make a difference?

#1130164

Unfortunately no, there's not a good way to apply a custom order to the output of repeating fields in the current software regardless of field type. It would require custom code that falls outside the scope of support we provide here in the forums.

#1130233

I see. Sorry to be redundant - just want to be super clear. I don't think I'm asking for custom ordering per se. All I want to achieve is if there are say 5 instances of a repeating field called 'color' with values of green, blue, red, yellow, and orange that they could be sorted/displayed in alphabetical order upon rendering rather than the numerical ID ordering they were originally saved in. You're saying that can't be done. Is that correct? Thanks in advance, Christian.

#1131451

You are correct, it is not possible to sort the displayed values in any order other than the order in which the options are defined in the Custom Field Group editor screen. You can reorder the options as desired in the Custom Field Group editor, but any other display order modification requires custom code.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.