简体   繁体   中英

How to get value from checkbox list in October CMS custom plugin

I entered project_toolbox into my plugin's database table and created checkbox list named project_toolbox with 10 values. How can I retrieve those value if checked from the backend.

Here is what I was unable to get the value of the checkbox value

<div class="project-toolbox">
{% for toolbox in project.project_toolbox %}
    <div class="{{ option.name }}"><span>{{ toolbox.name }} Hello</span></div>
{% endfor %}
</div>

在此处输入图像描述

You can simply iterate through array

<div class="project-toolbox">
{% for toolbox_item in project.project_toolbox %}
    <div class="{{ option.name }}"><span>{{ toolbox_item }} Hello</span></div>
{% endfor %}
</div>

You can directly use string value {{ toolbox_item }} as project_toolbox is the array of strings.

if any doubt please comment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM