Saltar navegación

[Resuelto] Is there a way to default repeating fields as expanded instead of collapsed?

This support ticket is created hace 6 años, 6 meses. 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Etiquetado: 

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por larryB-3 hace 6 años, 6 meses.

Asistido por: Nigel.

Autor
Mensajes
#914979
Screen Shot 2018-06-18 at 5.08.40 PM.jpg

When a user opens a CPT on the back-end and their is a custom repeating field that has values already input, is there a way to default those fields to be expanded instead of collapsed?

#915156

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Larry

No, but I may be able to point you in the direction of a JS snippet that would do the job.

Before I look into that, though, I'm not sure why you are using repeatable field groups rather than simple repeating fields.

It looks like you are letting users add multiple phone numbers and multiple email addresses to a post.

You would use repeatable field groups when you some of the field values were connected with each other.

For example, you might add multiple contacts to a post, and for each contact you would provide a name, email address and phone number. So you create a repeatable field group for contacts which includes fields for email and for phone.

In your case it looks like your repeatable field groups contain just one field, for which you can just use simple fields where you can add multiple instances of the field, so you can add as many phone numbers are required, and as many email addresses as required.

If that's the case you can change to using repeating fields and then your question no longer applies.

Let me know.

#915242

Ok, I wasn't aware of that. I bet there isn't an easy way to convert from the repeating field groups to simple repeating fields without loosing the data I have in those fields???

#915281

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Not readily, no.

Custom fields are stored in wp_postmeta against the post they belong to.

But with RFGs a post is created for each instance of a repeating field group to act as a container for the fields, so the fields themselves are still stored in wp_postmeta but against the container post, not the original post.

So to convert them would mean running a script that loops over all of the RFG posts and then updates the post meta for the post to which the RFG belongs using the post meta from the RFG post.

Is it a *lot* of data?

#915411

Ok, I will leave as is. Thanks for your help. For the future, maybe if there is a post/tutorial on the differences between a repeating field and a repeating field group and when to use one versus the other would be helpful to users.