[Zope-DB] Problem wiith dtml-sqltest variable and multiples values into one parametert ???

Cynthia Kiser cnk+zope at caltech.edu
Wed Nov 29 12:53:29 EST 2006

Quoting CERETTO Thierry <t.ceretto at chu-nancy.fr>:
> In "search form" (Page Template), I have created a select field (called
> "select_keys") to select one or more keys words (from MySQl table). On
> submit, with javascript, I fill an hidden field called "ref_fiche" where
> I put a list (JS array) of value select in field "select_keys", for
> example, value can be : f1 or f1,f4,f2, etc

> but, in Zope message above, the SQL used which I see "(ref_Fiche = 'f1,
> f4')" and not "ref_Fiche IN ('f1','f4') Why ?
> How pass one list parameter ?   

I can't tell without reading more widely if one could pass a list
parameter but the behavior as you describe it indicates that you
should not be passing a single variable that contains a list. Instead
you should be passing multiple parameters all called ref_Fiche with
different values. For example, if this form were to be sent as a GET
request, you should send ?ref_Fiche=f1&ref_Fiche=f4 rather than
?ref_Fiche=f1,f4 I think the dtml-sqltest is pulling the variables out
of the request object and is seeing a single variable called ref_fiche
and so is constructing the sql that is appropriate to a single
value. To get it to construct something like "ref_Fiche in (f1,f4)"
you will need to have multiple ref_Fiche variables in the request

More information about the Zope-DB mailing list