Jump to content

Accessing a particular instance of a repeater field


thetuningspoon
 Share

Recommended Posts

I'm stumped.

I have a repeater setup like so:

                        Repeater

      Repeater 1                 Repeater 2

Field 1      Field 2         Field 1      Field 2

If I know the ID of Repeater 1, how do I get the value of one of its child fields?

I tried  $page->get(id)->field_2  to no avail.

What I'm trying to do is maybe a bit complex/weird. Basically, I am looping through a repeater to populate a select box in a contact form (non form-builder, just my own php in the template). I need some sort of id to serve as the value attribute on the select option so that I can then use it to identify and pull the data from the other field in the same instance of that repeater when the form gets posted.

I hope that sort of makes sense...

Link to comment
Share on other sites

It's not a nested repeater-- I'm just showing that it is one repeater with multiple instances on the page, i.e. it has two "items" added to it, with each item consisting of two fields.

So I guess the real question I'm asking is, how do I call just one of the instances of a repeater in the wirearray through the api? Should ID work?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...