Forum OpenACS Q&A: Re: Collecting POST variables

Collapse
Posted by Steve Manning on
I do this by giving the controls an array name then passing in an array in the page contract something like this...

ADP
===
<form ...>
  <select name="item.1">
      <option value="1">X</option>
  </select>
  <select name="item.2">
      <option value="1">X</option>
  </select>
  <select name="item.3">
      <option value="2">Y</option>
  </select>
  ...
  <submit, etc.>
</form>

NB the fullstop between the item and number in the name, this is how arrays are passed in (or at least it works for me)

TCL
===

{item:array,optional} in the page contract

then reference each control by iterating throught the array

for {set n 0} {n < 10} {incr n} {
  set item_value $item($n)
}

Hope this helps.

    -Steve