Returning a checkbox value

Hey All,

I’m trying to return the value of options within a checkbox.

Currently I have defined in my blueprint:

projectInformation:
label: Project Information - Services
type: checkboxes
options:
  d: Digital
  p: Print
  vi: Visual Identity

And within my template:

<?php foreach($page->projectInformation()->categories()->split() as $category): ?>
  <li>
    <input name="<?php echo html($category) ?>" type="checkbox">
    <span class="label-body"><?php echo html($category) ?></span>
  </li>
<?php endforeach ?>

It’s working as expected, but it’s returning (“vi”) where I need it to return “Visual Identity”.
I’m guessing it has something to do with this:

<?php echo html($category) ?>

Any ideas? Solutions?
Thanks everyone.

The value that gets into your text file, is the part before the colon, i.e. vi, the part after is just what is displayed to the user. So in order to display Visual Identity, you have to put that in front of the colon.

1 Like

I found this on the old forums. I haven’t tested it out though.

1 Like

Thanks @texnixe & @Luke.

Is there in Kirby version 2.1.0 a possibility to access directly to the text of the chosen option of a checkbox or a radio field within the template file?

@bastianallgeier:
How do I reset the marking “Solved” of this thread?

@bastianallgeier, @distantnative, @texnixe:

Are there any news about a possibility to access directly to the text of the chosen option of a checkbox or a radio field within the template file and how I can go to the old forum???

Any update on? I may try to access the field with kirby’s yaml api.

No, Kirby does not read the blueprints. You would have create your own method to access and read the blueprint files.