# Get Actual Page Object from Checkbox/Select

**URL:** <https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025>\
**Category:** Questions\
**Tags:** v3\
**Created:** [November 10, 2020, 7:46pm UTC](https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025 "2020-11-10T19:46:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brighurst](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/brighurst/32/9714_2.png) [@Brighurst](https://forum.getkirby.com/u/Brighurst)\
**Post date:** [November 10, 2020, 7:46pm UTC](https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025/1 "2020-11-10T19:46:25Z")

</div>

I’m trying to use a `checkbox` field populated with a `query` of published children like so:

```
      checkbox:
        label: Featured Projects
        help: Select projects to feature on the homepage. To choose episodes for each project, visit the project page itself. 
        min: 1
        max: 5
        type: checkboxes
        options: query
        query: 
          fetch: page.children.published
          text: "{{ page.title }}"
          value: "{{ page }}"

```

While it is pulling the string that I want, I actually am trying to use the checkbox to select pages to then feature on the homepage like so:

```
<figure class="main-carousel" id="<?= $page->uid() ?>">
<?php foreach ($center->checkbox()->split() as $project): ?>
  <li><?= $project->text() ?></li>
<?php endforeach ?>
</figure>

```

however, I keep getting the error `Call to a member function text() on string` which leads me to believe that the checkbox field is converting into a string.

Would there be any way to pull the actual page itself from the checkbox? or is there a field better suited to that?

Or would I then have to use this string and `findBy` to get the actual page?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 10, 2020, 7:51pm UTC](https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025/2 "2020-11-10T19:51:32Z")

</div>

> [@Brighurst](#):
>
> ` value: "{{ page }}"`

Because `$project` is only a string. What you want to do is create a collection of pages from what is stored in your field.

Additionally, what is `text()` supposed to be, a field in your projects?

```auto
$projects = $center->checkbox()->toPages(',');
foreach ( $projects as $project) 
  // do stuff
}

```

However, for this to work you have to store the page.id as value not `page`.

---

<div class="post-metadata">

**Author:** ![Brighurst](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/brighurst/32/9714_2.png) [@Brighurst](https://forum.getkirby.com/u/Brighurst)\
**Post date:** [November 10, 2020, 7:54pm UTC](https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025/3 "2020-11-10T19:54:07Z")

</div>

Will try this out in a second!

And as for `text`, that was just a placeholder to chose what returns an error.

This whole structure goes one level deeper so I’m actually going to use this to return one more `page object` and from there pull an `image` or `video`

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 10, 2020, 7:56pm UTC](https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025/4 "2020-11-10T19:56:30Z")

</div>

I added a comma I forgot to the `toPages()` method.

---

<div class="post-metadata">

**Author:** ![Brighurst](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/brighurst/32/9714_2.png) [@Brighurst](https://forum.getkirby.com/u/Brighurst)\
**Post date:** [November 10, 2020, 7:59pm UTC](https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025/5 "2020-11-10T19:59:21Z")

</div>

so my field should look like this?

```
        query: 
          fetch: page.children.published
          text: "{{ page.title }}"
          value: "{{ page.id }}"

```

As of right now, i’m just getting blanks with the code.

---

<div class="post-metadata">

**Author:** ![Brighurst](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/brighurst/32/9714_2.png) [@Brighurst](https://forum.getkirby.com/u/Brighurst)\
**Post date:** [November 10, 2020, 8:02pm UTC](https://forum.getkirby.com/t/get-actual-page-object-from-checkbox-select/20025/6 "2020-11-10T20:02:18Z")

</div>

Wait that was my fault. The panel depopulated the field. It’s working now!
