thetuningspoon Posted February 5, 2013 Share Posted February 5, 2013 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 More sharing options...
Wanze Posted February 5, 2013 Share Posted February 5, 2013 I'm not sure if this is still possible, but you should not use nested repeaters (repeater in repeater). Can you give an example code of what you want to achieve, I think I didn't get it Link to comment Share on other sites More sharing options...
thetuningspoon Posted February 5, 2013 Author Share Posted February 5, 2013 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 More sharing options...
Soma Posted February 5, 2013 Share Posted February 5, 2013 What id, and from where you got it? If you got the repeater id (which is a page behind the scenes) you just do. echo $pages->get($id)->myfield; 2 Link to comment Share on other sites More sharing options...
thetuningspoon Posted February 5, 2013 Author Share Posted February 5, 2013 Thank you Soma! That was it. I just needed to use $pages instead of $page Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now