[Zope] spaces in postgres data field

Ian Sealy Ian.Sealy@bristol.ac.uk
Wed Aug 6 13:19:59 EDT 2003


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





More information about the Zope mailing list