[Amrita2-users] Amrita2 Question about how to use select and checkbox with a collection, or ideas on how I can extend Amrita to do this

Jeff Barczewski jeff.barczewski at gmail.com
Fri Jul 15 10:38:40 EDT 2005


I was trying to figure out if there is a way to use select in Amrita2
with a collection (array, Enumeration, ...)

For instance I would like to do something like

<select id='sel1' amrita:type='select'>
  <option id='optValues' amrita:type='use_args' value='$1'>$2</option>
</select>

and I would somehow give it an array of values
optionValues = [
  ["a","aaa"],
  ["b","ghi"],
  ["c","jkl"]
]


>From what I can tell with the examples it only shows select being used
for a static predefined option list like so
      <select id='sel1' amrita:type='select'>
        <option value='a'>aaa</option>
        <option value='b'>bbb</option>
        <option value='c'>ccc</option> 
      </select>

However for database driven applications, most of the time these
options are queried from the database and then dynamically filled into
the select box at runtime. Since Amrita does a nice job of iterating
on a collection this by itself is easy, however I don't know if it is
possible to combine the functionality so that the collection creates
the option values, and the select knows which one to mark as
'selected'.

Maybe one would even simply the syntax and just do something like
<select id='sel1' amrita:type='select' amrita:values='optValues'>
</select>

Similarly it would be nice to be able to do a similar thing with
checkboxes such that a whole collection of them can be rendered based
on a collection of values and a collection of selected values.
<input id='checkboxes' amrita:type='checkbox' name='cb1'
type='checkbox'  amrita:selectedValues='selValues'/>
where checkboxes would be a collection of checkbox values and
descriptions, and selValues would be a collection of the selected
values.

Anyway, if anyone has any ideas how this can be done currently in
Amrita2 I would appreciate any help. Otherwise if there are
suggestions on how I might extend Amrita2 to add this functionality I
would like to help to do that as well, I just need to be pointed in
the right direction and maybe given an idea on how to do a plugin or
what is needed.

Thanks for your help,

Jeff Barczewski



More information about the Amrita2-users mailing list