Re[2]: [Zope] absent variables

Thomas B. Passin tpassin@mitretek.org
Thu, 19 Apr 2001 11:22:11 -0400


Miha, I don't know what you are asking for.  What do you want a solution
for?  There isn't one answer for all problems.

Tom P

Miha wrote -

> Hello Thomas,
>
> Your words are right, but that isn't context depended problem. Here I
> can find simple solution, but in other keys? Big thanks for you
> attention.
>
> ...
>
> TBP> 1) You are using a checkbox for the "favorite" input element.  When a
> TBP> checkbox is not checked, it does not return a variable of that name
in the
> TBP> form.
>
> TBP> 2) You have more than one checkbox with the name "favorite".  If more
than
> TBP> one are checked, the form will return a list containing all the
values.
> TBP> Furthermore, if only one is checked, the form will return a single
string,
> TBP> not a list.  This would require further testing and handling.  You
can make
> TBP> the form always return a list by changing the name of the input to
> TBP> "favorite:list".  You would still refer to the variable as
"favorite".
>
> TBP> Both possiblities will cause errors for your insert statement.
>
> TBP> First, you need to decide whether you really want to allow more than
one
> TBP> "favorite" value.  If you do, you need to figure out how they should
be
> TBP> represented in the database.  Then you need to loop through the
values.
>
> TBP> If you decide you only want one value, you can change to using radio
> TBP> buttons.  One button could have the value '' (the empty string), and
the
> TBP> lable "No Favorite".  This way, you would always get a single string
in the
> TBP> form data, although it might be an empty string.  Your insert code
would
> TBP> work correctly.
>