[Zope] Altering values from HTML forms before SQL insert

Neil Bartlett nbartlett@algorithmics.com
Thu, 17 Feb 2000 15:17:14 -0500


Thanks Jeff - not only does it makes sense it works! Hadn't realized that
dtml-let and dtml-with were only scoped at the current level.

Is there a syntax for saying set value at this and nested levels but do not
persist? (More curious than have a need!)

Neil

> -----Original Message-----
> From: Jeff K. Hoffman [mailto:jeff@goingv.com]
> Sent: Thursday, February 17, 2000 3:07 PM
> To: Neil Bartlett
> Cc: zope@zope.org
> Subject: Re: [Zope] Altering values from HTML forms before SQL insert
>
>
> On Thu, 17 Feb 2000, Neil Bartlett wrote:
>
> > I have a HTML form that returns a value that I need to
> alter before I pass
> > it to a SQLMethod.
> >
> > To do this I created I've assumed I should use either
> dtml-with or dtml-let
> > to create a new variable with my desired value and then
> call the SQL MEthod
> > within the dtml-with.
>
> [snip]
>
> > DTML Document:
> >
> > <dtml-var standard_html_header>
> > 	<dtml-with "_.namespace(LocationAndTime=Location+'--now')">
> > 		<dtml-comment>
> > 			<dtml-call odbcInsertTalk>
> > 		</dtml-comment>
> > 		<ul>
> > 			<li>Location: [<dtml-var LocationAndTime>]
> > 		</ul>
> > 	</dtml-with>
> > <dtml-var standard_html_footer>
>
> I would try:
>
>   <dtml-var standard_html_header>
>
>   <dtml-call expr="REQUEST.set('LocationAndTime', Location +
> '--now')">
>   <dtml-call odbcInsertTalk>
>   <ul>
>     <li>Location: [<dtml-var LocationAndTime>]
>   </ul>
>
>   <dtml-var standard_html_footer>
>
> > I get my desired values for LocationAndTime for the code as
> shown however,
> > if I uncomment <dtml-call odbcInsertTalk> then I get a complaint
>
> This makes sense; modifications to the namespace through
> dtml-let and/or
> _.namespace() are local to that DTML Document/Method only. To
> persistently
> modify the namespace, you have to use REQUEST.set().
>
> > Any help would be very apprecitated.
>
> Hope this helps.
>
> > Neil Bartlett
>
> --Jeff
>
> ---
> Jeff K. Hoffman
> 704.849.0731 x108
> Chief Technology Officer
> mailto:jeff@goingv.com
> Going Virtual, L.L.C.
> http://www.goingv.com/
>