[ic] Use Checkboxes instead

Kevin Walsh interchange-users@icdevgroup.org
Fri Jan 17 17:49:00 2003


Mike Heins [mike@perusion.com] wrote:
> Quoting Jeff Dafoe (jeff@badtz-maru.com):
> > 
> > I suspect if you set the name of the checkbox to the same thing that the
> > quantity value is currently named and set the value of the checkbox to "1"
> > it might do what you want.
> > 
> Thus we have the problem with checkboxes -- they are simply not sent
> if not checked.
> 
> Therefore, you can't do:
> 
>     <input type=hidden name=mv_order_item value=foo>
>     <input type=checkbox name=mv_order_quantity value=1>
> 
>     <input type=hidden name=mv_order_item value=bar>
>     <input type=checkbox name=mv_order_quantity value=1>
> 
> Both will be ordered no matter what.
> 
> The only solution is to introduce some protocol of your own. Luckily
> with IC and ActionMap, this is extremely easy to do.
>
The following test code works for me:

<form action="[process]" method="POST">
    <input type="hidden" name="mv_todo" value="refresh">
    foo: <input type="checkbox" name="mv_order_item" value="foo"><br>
    bar: <input type="checkbox" name="mv_order_item" value="bar"><br>
    <input type="submit" name="Checkbox test"><br>
</form>

The quantity defaults to one so it doesn't need to be specified.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/