ZSQL field problem
Hi, All. I have a form that allows a user to edit a table with a date field. The user should be able to 'null' the date field. I'm using a ZSql method similar to this (very simplified): update sometable set (birthday = <dtml-sqlvar birthday type="string">) where username = 'someuser'; If the user cleared the text input field for the birthday, I'd like to have it say: set birthday = null where username = 'someuser'; But all I get is: set birthday = 'None' where username = 'someuser'; Any suggestions? Colin -- Colin Fox cfox@cfconsulting.ca CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
Hello Colin, Tuesday, August 13, 2002, 10:23:28 PM, you wrote: ... CF> The user should be able to 'null' the date field. ... CF> set (birthday = <dtml-sqlvar birthday type="string">) i think type=nb would work the way you want.. (the nb means non-blank , meaning replace the empty string with NULL) :) -- Geir Bækholt web-developer geirh@funcom.com funcom oslo | webdev-team
On Tue, 2002-08-13 at 13:47, Geir Bækholt wrote:
Hello Colin, <..> i think type=nb would work the way you want..
(the nb means non-blank , meaning replace the empty string with NULL)
I tried making it 'type="nb"', and I got: Invalid empty string value for birthday I use a script to validate the form fields. I've tried: if birthday == '': birthday = None but somewhere it gets turned into the string "None" instead of the Python value None, and "None" isn't a real date. So I took the conversion from '' to None out, and got the "Invalid empty string value for birthday" error. There must be a way to do this - you couldn't set an integer or float to '' either. -- Colin Fox cfox@cfconsulting.ca CF Consulting Inc. GPG Fingerprint: D8F0 84E7 E7CC 5C6C 9982 F1A7 A3EB 6EA3 BC97 572F
participants (2)
-
Colin Fox -
Geir Bækholt