<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>If you have a line like</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&lt;input type="text" name="first_name" 
value="default value"&gt;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>in your html file then if you try the following in 
your script file</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>print REQUEST['first_name']&nbsp; </FONT></DIV>
<DIV><FONT face=Arial size=2>return printed</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>you should see "default value" printed 
out</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>you can try:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>print REQUEST</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>to see the entire contents of REQUEST (very 
informative)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Note: if you do not have a default value in your 
&lt;input&gt; statement and you do not enter anything in the input field when 
the form is displayed, then when the form is submitted REQUEST will not contain 
an entry for the corresponding form field (an entry is made in REQUEST only when 
data is entered in the form field)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jonathan</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=myan@umich.edu href="mailto:myan@umich.edu">Muk Yan</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=dev101@magma.ca 
  href="mailto:dev101@magma.ca">Jonathan</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Cc:</B> <A title=zope@zope.org 
  href="mailto:zope@zope.org">zope@zope.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, August 17, 2006 4:40 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Zope] Python Scripts and 
  HTML Forms</DIV>
  <DIV><BR></DIV>Hey All,<BR><BR>Sorry about that, what I meant is that I get a 
  KeyError. It says that the first_name in REQUEST['first_name'] is not found, 
  when I try to set the variable in line in the script where <SPAN class=e 
  id=q_10d1dd5ce8b0cb1a_4><FONT face=Arial size=2>fname = 
  REQUEST['first_name'].<BR><BR>Thanks in 
  advance.<BR><BR>Cheers,<BR>Muk<BR></FONT></SPAN><BR>
  <DIV><SPAN class=gmail_quote>On 8/17/06, <B 
  class=gmail_sendername>Jonathan</B> &lt;<A href="mailto:dev101@magma.ca"> 
  dev101@magma.ca</A>&gt; wrote:</SPAN>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
    <DIV>
    <DIV bgcolor="#ffffff">
    <DIV><FONT face=Arial size=2>What does "it doesn't seem to work" mean?&nbsp; 
    Error messages/traceback? What does your form &amp; script contain?&nbsp; 
    More info on the problem is definitely required!</FONT></DIV></DIV>
    <DIV><SPAN class=sg>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Jonathan</FONT></DIV></SPAN></DIV>
    <DIV>
    <BLOCKQUOTE 
    style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px"></BLOCKQUOTE></DIV>
    <DIV><SPAN class=q>
    <DIV 
    style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">----- 
    Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; moz-background-clip: -moz-initial; moz-background-origin: -moz-initial; moz-background-inline-policy: -moz-initial"><B>From:</B> 
    <A title=myan@umich.edu 
    onclick="return top.js.OpenExtLink(window,event,this)" 
    href="mailto:myan@umich.edu" target=_blank>Muk Yan</A> </DIV></SPAN></DIV>
    <DIV><SPAN class=e id=q_10d1dd5ce8b0cb1a_4>
    <DIV 
    style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B> 
    <A title=dev101@magma.ca 
    onclick="return top.js.OpenExtLink(window,event,this)" 
    href="mailto:dev101@magma.ca" target=_blank>Jonathan</A> ; <A 
    title=zope@zope.org onclick="return top.js.OpenExtLink(window,event,this)" 
    href="mailto:zope@zope.org" target=_blank>zope@zope.org</A> </DIV>
    <DIV 
    style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B> 
    Thursday, August 17, 2006 4:20 PM</DIV>
    <DIV 
    style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B> 
    Re: [Zope] Python Scripts and HTML Forms</DIV>
    <DIV><BR></DIV>Hey Jonathan, All,<BR><BR>Thanks I tried your solution, but 
    it doesn't seem to work.&nbsp; Can anybody shed some more light on this 
    situation, since what Jonathan provides is exactly what I want to do, but 
    it's not working.<BR><BR>Am I forgetting to put parameteres or some other 
    newbie mistake like that?<BR><BR>Thanks in advance and thanks again 
    Jonathan.<BR><BR>-Muk<BR><BR>
    <DIV><SPAN class=gmail_quote>On 8/17/06, <B 
    class=gmail_sendername>Jonathan</B> &lt;<A 
    onclick="return top.js.OpenExtLink(window,event,this)" 
    href="mailto:dev101@magma.ca" target=_blank>dev101@magma.ca</A>&gt; wrote: 
    </SPAN>
    <BLOCKQUOTE class=gmail_quote 
    style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
      <DIV>
      <DIV bgcolor="#ffffff">
      <DIV><FONT face=Arial size=2>Form variables are stored in REQUEST. In a 
      python script you gain access to REQUEST by:</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2>REQUEST&nbsp;= 
      container.REQUEST<BR></FONT></DIV>
      <DIV><FONT face=Arial size=2>you can then access the form variables 
      by:</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2>fname = REQUEST['first_name']</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial size=2>you can check for the presence of a form 
      variable by</FONT></DIV>
      <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial><FONT size=2>if 
      REQUEST.has_key('first_name'):</FONT></FONT></DIV>
      <DIV><FONT face=Arial><FONT size=2></FONT></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial><FONT size=2>or</FONT></FONT></DIV>
      <DIV><FONT face=Arial><FONT size=2></FONT></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial><FONT size=2>if REQUEST.get('first_name', 
      None):</FONT></FONT></DIV>
      <DIV><FONT face=Arial><FONT size=2></FONT></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial><FONT size=2></FONT></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial><FONT size=2>hth</FONT></FONT></DIV>
      <DIV><FONT face=Arial><FONT size=2></FONT></FONT>&nbsp;</DIV>
      <DIV><FONT face=Arial><FONT size=2>Jonathan</FONT></FONT></DIV>
      <DIV><FONT face=Arial><FONT size=2></FONT></FONT>&nbsp;</DIV>
      <BLOCKQUOTE 
      style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px"></BLOCKQUOTE></DIV>
      <DIV><SPAN>
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">----- 
      Original Message ----- </DIV>
      <DIV 
      style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; moz-background-clip: -moz-initial; moz-background-origin: -moz-initial; moz-background-inline-policy: -moz-initial"><B>From:</B> 
      <A title=myan@umich.edu 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:myan@umich.edu" target=_blank>Muk Yan</A> </DIV>
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B> 
      <A title=zope@zope.org 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:zope@zope.org" target=_blank>zope@zope.org</A> </DIV>
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B> 
      Thursday, August 17, 2006 2:57 PM</DIV>
      <DIV 
      style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B> 
      [Zope] Python Scripts and HTML Forms</DIV>
      <DIV><BR></DIV>Dear Trusted Zope Zealots,<BR><BR>This subject was a bit 
      too broad to do a google search on, because I've tried and the lack of 
      relevancy was astounding.<BR><BR>I've probably been committing a cardinal 
      sin in DTML, but I couldn't figure any other work around. <BR><BR>I have 
      an HTML form in a DTML Document say:<BR><BR>&lt;form 
      action="process_this_form" method="post"<BR><BR>Name:&lt;input type="text" 
      name:"first_name"&gt;<BR><BR>&lt;/form&gt; <BR><BR>I want to use 
      "first_name" in a python script, but what I've been doing is setting it in 
      the process_this_form, which is a DTML method:<BR><BR>DTML Method, 
      process_this_form:<BR>&lt;dtml-call "REQUEST.SESSION.set ('firstName', 
      first_name)&gt;<BR>&lt;dtml-call 
      "this_is_a_python_script()"&gt;<BR><BR>and in the Python Script, 
      this_is_a_python_script<BR>I use 
      REQUEST.SESSION.get('firstName')<BR><BR>What my question is, is there 
      anyway to directly access "first_name" from the form in the python script 
      without having to have to call the &lt;dtml-call " 
      REQUEST.SESSION.set('firstName', first_name)&gt; and then 
      REQUEST.SESSION.get('firstName') in the python script.&nbsp; Sort of a 
      sophomoric question, but any help would be appreciated.&nbsp; Thanks in 
      advance.<BR><BR>-Muk<BR></SPAN></DIV>
      <DIV>
      <P></P>
      <HR>

      <P></P>_______________________________________________<BR>Zope 
      maillist&nbsp; -&nbsp; <A 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="mailto:Zope@zope.org" target=_blank>Zope@zope.org</A><BR><A 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="http://mail.zope.org/mailman/listinfo/zope" 
      target=_blank>http://mail.zope.org/mailman/listinfo/zope</A><BR>**&nbsp;&nbsp; 
      No cross posts or HTML encoding!&nbsp; **<BR>(Related lists - <BR>&nbsp;<A 
      onclick="return top.js.OpenExtLink(window,event,this)" 
      href="http://mail.zope.org/mailman/listinfo/zope-announce" 
      target=_blank>http://mail.zope.org/mailman/listinfo/zope-announce 
      </A><BR>&nbsp;<A onclick="return top.js.OpenExtLink(window,event,this)" 
      href="http://mail.zope.org/mailman/listinfo/zope-dev" target=_blank> 
      http://mail.zope.org/mailman/listinfo/zope-dev</A> )<BR>
      <P></P></DIV></DIV></BLOCKQUOTE></DIV><BR></SPAN></DIV>
    <DIV></DIV></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>