Skip Navigation

[Resolved] Displaying the index number of a repeated field

This support ticket is created 4 years, 8 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 2 replies, has 2 voices.

Last updated by frederikB 4 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1328773

I am trying to display the index number of a repeated field, so that I can send each instance through a form with a unique name. This is becoming a questionnaire.

I found https://toolset.com/forums/topic/display-index-number-of-repeating-field/ but this topic is very old and the solution there does not work.

What is the link to your site? hidden link

#1328933

Hi, there's nothing exactly like that available in Toolset but I might be able to help you achieve what you want another way. Can you be more specific about what you want to accomplish? For example, you may be able to use a series of conditionals like this:

[wpv-conditional if="('[types field="your-repeating-field-slug" index="0" separator=","][/types]' ne '')"]
  0: [types field="your-repeating-field-slug" index="0" separator=","][/types]
[/wpv-conditional]
[wpv-conditional if="('[types field="your-repeating-field-slug" index="1" separator=","][/types]' ne '')"]
  1: [types field="your-repeating-field-slug" index="1" separator=","][/types]
[/wpv-conditional]
[wpv-conditional if="('[types field="your-repeating-field-slug" index="2" separator=","][/types]' ne '')"]
  2: [types field="your-repeating-field-slug" index="2" separator=","][/types]
[/wpv-conditional]
#1330719

I couldn't get the solution you provided too work, but I will work around it in PHP. I will just push the results to an array, that also gives me an index number.

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