[Zope] Checkboxes/SQL data type problem

J.H.Whalley J.H.Whalley@mmu.ac.uk
Thu, 20 Jun 2002 12:56:13 GMT


I've already got the suffixes in place in the form:

<input type="checkbox" name="action_list:int:list" value="<dtml-var 
ejournal_id>" checked>

It looks like something is breaking somewhere else.

Thanks for the URL, by the way: this is a resource I'd missed in my 
travels and I'm now working my way through it.

Thanks,
John Whalley

On 19 Jun 02, at 20:27, Dieter Maurer wrote:

> J.H.Whalley writes:
>  > ...
>  > I'm having trouble updating a set of records in an external DB,
>  selecting the > records using checkboxes on a form. Code is below. > >
>  The form appears to be producing the expected list of integers which are
>  the > record ids which need updating: if I get the results page to just
>  display > action_list it comes out as [15, 18] etc. > >
>  ActionUpdateMethod works fine when I test it with a single record number.
>  > > The results page should iterate over the list of record ids and
>  update each > record in turn. > > What actually happens is I get an error
>  message: > > Error Type: sql.error > Error Value: ('22005', -3030,
>  '[Microsoft][ODBC Microsoft Access Driver] Data > type mismatch in
>  criteria expression.') > > Which looks like it isn't an integer which is
>  getting passed via the SQL. Yet > as far as I can see, the list is a list
>  of integers, the ZSQL argument tells > it it's an integer and the sqlvar
>  tag tells it it's an integer. > > What am I doing wrong?
> You know that all parameters passed from an HTML form are strings
> in the first place. Thus, what looks like a list of integers is
> probably a single string that just looks like a list.
> 
> You can use type suffixes in form variable names to tell Zope
> how to convert and pack HTML form data. For example, to get
> a list of integers, you can have:
> 
>   <input name="recno:int:list" ...>
>   <input name="recno:int:list" ...>
> 
> For details, see
> 
>   <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
> 
> 
> 
> Dieter



--
* John Whalley, Crewe Site Library, Manchester Metropolitan University
* email: J.H.Whalley@mmu.ac.uk
* Phone: (+44) 161 247 5220 (UK)
* Usual disclaimer applies...........