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
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]
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.