Ok I figured it out. This is what I ended up doing: <dtml-if "len(ipAddress) > 0"> insert into NetInt(IPAddress, SystemNetName) Values( '<dtml-var name="ipAddress" sql_quote>', '<dtml-var name="HostName" sql_quote>' ) </dtml-if> Thanks for the suggestions and the time. -Laura -----Original Message----- From: Jim Abramson [mailto:jabramson@wgen.net] Sent: Thursday, October 07, 2004 1:07 PM To: Laura McCord Cc: zope-db@zope.org Subject: RE: [Zope-DB] zsql question That should pretty much do it. If you want to go even further, you could write a python script to make sure the IP address is valid and make that your if condition: <dtml-if "validIpAddress(ipAddress)">insert... You could dtml-raise if the ip was _not_ valid (I _think_ that would work in a sqlmethod...) Jim
-----Original Message----- From: Laura McCord [mailto:Laura.McCord@doucet-austin.com] Sent: Thursday, October 07, 2004 1:05 PM To: zope-db@zope.org Subject: [Zope-DB] zsql question
I am trying to do an insert but I do not want the insert to occur if the value of "ipAddress" was not entered in the form.
So far I have this:
insert into NetInt(IPAddress, SystemNetName) Values( '<dtml-var name="ipAddress" sql_quote>', '<dtml-var name="HostName" sql_quote>' )
I am thinking that I have to put a conditional statement such as <dtml-if ipAddress> insert into NetInt(IPAddress, SystemNetName) Values( '<dtml-var name="ipAddress" sql_quote>', '<dtml-var name="HostName" sql_quote>' ) </dtml-if>
Any suggestions?
Thanks, Laura _______________________________________________ Zope-DB mailing list Zope-DB@zope.org http://mail.zope.org/mailman/listinfo/zope-db
participants (1)
-
Laura McCord