[Zope] ZSQL question

Casey Duncan casey@zope.com
Wed, 27 Mar 2002 16:56:42 -0700


There is a trick for passing default values from forms in this case 
using marshaling:

<input type="checkbox" name="foo" value="somevalue" />
<input type="hidden" name="foo:default" value="somedefault" />

The latter line uses a zope marshaling trick. If ZPublisher sees no 
other value for "foo" besides the default one it uses the default value 
from the hidden field. Otherwise it uses the value from the checkbox.

hth,

Casey

Colin Fox wrote:
> Hi, all.
> 
> I have a ZSQL insert function that requires an optional parameter. 
> 
> The variables are coming from an HTML form, and one of the variables is
> a checkbox. Apparently, if the checkbox is unchecked, the variable
> doesn't appear.
> 
> As a small example, let's say there were two strings and a checkbox,
> labelled str1, str2 and cb. I need this:
> 
> insert into mytable(col1, col2, col3) values (str1, str2, cb)
> 
> as well as
> 
> insert into mytable(col1, col2) values (str1, str2)
> 
> if cb is None.
> 
> I can't find any examples of optional insert variables, just optional
> join parameters.
> 
> Also - is there a comprehensive ZSQL document anywhere?
> 
> Thanks!
> 
>