mardi 15 mars 2016

ractive.js multiple checkboxes

This is much like the common multiple checkbox question all over the web, except my list of checkboxes is dynamic.

Simplified:

{{#user}}
    <h2>Roles</h2>
    {{#allRoles:roleIndex}}
      <input type='checkbox' name='{{roles}}' value='{{.id}}'> {{.name}}<br>
    {{/}}
{{/}}

I want to iterate over allRoles (in ~/) and get an array of checked boxes in user.roles but since {{#allRoles:roleIndex}} changes the keypath, I cant figure out how to put roles inside user.




Aucun commentaire:

Enregistrer un commentaire