[ic] [Checked]

interchange-users@lists.akopia.com interchange-users@lists.akopia.com
Wed Jun 13 20:41:00 2001


On Thu, Jun 14, 2001 at 12:49:33AM +0200, Stefan Hornburg (Racke) wrote:
> Victor Nolton <ven@pragakhan.com> writes:
> 
> > I have 9 <input type="checkbox">'s
> > By default none are checked. So far so good.
> > if the user clicks it and submits it, it is fine, if there is a error 
> > the page is displayed and they are given the errors of what they 
> > forgot to fill out. boxes are still checked appropriately.
> > 
> > IF they unclick one of the 9 boxes (which aren't required) and they 
> > submit if the page is redrawn (cause of errors) the boxes are checked 
> > again.
> > 
> > Checked the docs used some examples. no luck. I just need it so that 
> > if they uncheck a box it stays unchecked.
> > 
> > Anyone have any snippets of code?
> > checked reference http://interchange.redhat.com/cgi-bin/ic/dev/ictags_14.html
> 
> This is somewhat difficult because only checked boxes are passed
> by CGI, so the value isn't reset. My formel tag should handle
> this appropriately.

As long as your profile looks for the values specifically this is
not really a problem.

In other words from a possible selection of CHECKBOXes A-Z,
if you already have checked A,B,C,M,Q and you get back
B,C,Q,S then that is fine and long as the profile knows how to
rebuild the value.  We typically keep it as an array or
delimited string, not as separate values; that probably makes
it easier.

--

There is another brute force way.  You can set a second 
HIDDEN VALUE=0 to unset the CHECKBOX.  If the first one is not
checked (and therefore not sent) your hidden value will be found.
If it is checked, then the CHECKED value will be found.  You want
to =~s/\000.*//; the value.  This way gets into problems
with if($value) because it will exist when you might not expect
it.

cfm


-- 

Christopher F. Miller, Publisher                             cfm@maine.com
MaineStreet Communications, Inc         208 Portland Road, Gray, ME  04039
1.207.657.5078                                       http://www.maine.com/
Content management, electronic commerce, internet integration, Debian linux