[Zope] Altering values from HTML forms before SQL insert

Jeff K. Hoffman jeff@goingv.com
Thu, 17 Feb 2000 15:07:15 -0500 (EST)


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/