spaces in postgres data field
Hi all, I'm having an odd problem with zope. I'm using a postgres database to store address of employees. When I get the data from the database it drop off after the first space. and example would be if the address is 1234 candykane Ln. my text box on the screen would show 1234 only. The text box is set for 30 characters and I've tested the SQL statement in zope and I see it pulls in the full address spaces and all. The code looks something like this: SQL: select * from employee_records where (employee_id=<dtml-sqlvar employee_id>) DTML: <dtml-in "find_employee_rec(employee_id=employee_id)"> <input type="text" name=<dtml-var address1> size="30"> </dtml-in> I don't have the code right in front of me but that's pretty close. I've put under lines in the data base to take out the spaces and all the information shows up, which means that the full address is being passed. Thanks, Rex __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
Dear Rex,
I'm having an odd problem with zope. I'm using a postgres database to store address of employees. When I get the data from the database it drop off after the first space. and example would be if the address is 1234 candykane Ln. my text box on the screen would show 1234 only.
The text box is set for 30 characters and I've tested the SQL statement in zope and I see it pulls in the full address spaces and all.
The code looks something like this: SQL: select * from employee_records where (employee_id=<dtml-sqlvar employee_id>)
DTML: <dtml-in "find_employee_rec(employee_id=employee_id)"> <input type="text" name=<dtml-var address1> size="30"> </dtml-in>
I don't have the code right in front of me but that's pretty close. I've put under lines in the data base to take out the spaces and all the information shows up, which means that the full address is being passed.
Are you sure <input type="text" name=<dtml-var address1> size="30"> isn't <input type="text" value=<dtml-var address1> size="30"> ? Anyway, the latter would produce (for example): <input type="text" value=1234 candykane Ln size="30"> So the value would indeed be 1234. Try putting some quotes round it. That is: <input type="text" value="<dtml-var address1>" size="30"> You also need to quote any HTML in address1. Otherwise you'll have problems with addresses that contains quotes and other HTML characters. So: <input type="text" value="<dtml-var address1 html_quote>" size="30"> Cheers, Ian -- Dr Ian Sealy Internet Development Institute for Learning and Research Technology University of Bristol
Ian Sealy wrote:
Anyway, the latter would produce (for example):
<input type="text" value=1234 candykane Ln size="30">
So the value would indeed be 1234. Try putting some quotes round it. That is:
<input type="text" value="<dtml-var address1>" size="30">
One good reason to use ZPT; you can't generate HTML that's broken in the way Ian's suggestion fixes.
You also need to quote any HTML in address1. Otherwise you'll have problems with addresses that contains quotes and other HTML characters. So:
<input type="text" value="<dtml-var address1 html_quote>" size="30">
Another good reason to use ZPT, everything is HTML quoted by default, although you can optionally turn it off per statement usign the 'structure' keyword... Chris
participants (3)
-
Chris Withers -
Ian Sealy -
Rex McKanry