Hi,
for the 'type' attribute, use 'nb' instead of 'string' and it should work:
<dtml-comment> title: test arguments: msisdn connection_id: mydbconn </dtml-comment> select * from mytable <dtml-sqlgroup where> <dtml-sqltest msisdn op=eq type=nb optional> </dtml-sqlgroup>
thanks, Satchit
David Salgado wrote:
Hi there
I've got a form with an input text box called 'msisdn', and a ZSQL query like this;
<dtml-comment> title: test arguments: msisdn connection_id: mydbconn </dtml-comment> select * from mytable <dtml-sqlgroup where> <dtml-sqltest msisdn op=eq type=string optional> </dtml-sqlgroup>
This works fine if I supply a MSISDN in the text box - I get the records I expect. But, if I leave msisdn blank, then from the trace log I can see that the query that gets sent to the mysql database is "select * from mytable where msisdn='' ", and so I get no records when what I want is ALL the records.
My optional 'msisdn' parameter is always being supplied, even if I leave the text box empty. Is there any way I can prevent this from happening?
Eventually, I want to have a form with lots of fields to specify a variety of criteria, but if blank text boxes are always coming through as empty strings, it's not going to work.
Thanks in advance for any help.
David
_______________________________________________ Zope-DB mailing list [email protected] http://mail.zope.org/mailman/listinfo/zope-db
_______________________________________________ Zope-DB mailing list [email protected] http://mail.zope.org/mailman/listinfo/zope-db
