Hi Jonathan,<br><br>Thanks a lot, it works today, but it was acting up a bit yesterday. I really appreciate it, maybe I just needed to completely get rid of the browser cache.<br><br>Peace and thanks again,<br>Muk<br><br>
<div><span class="gmail_quote">On 8/17/06, <b class="gmail_sendername">Jonathan</b> <<a href="mailto:dev101@magma.ca">dev101@magma.ca</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">If you have a line like</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"><input type="text" name="first_name"
value="default value"></font></div>
<div><font face="Arial" size="2"></font> </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> </div>
<div><font face="Arial" size="2">print REQUEST['first_name'] </font></div>
<div><font face="Arial" size="2">return printed</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">you should see "default value" printed
out</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">you can try:</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">print REQUEST</font></div>
<div><font face="Arial" size="2"></font> </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> </div>
<div><font face="Arial" size="2">Note: if you do not have a default value in your
<input> 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><div><span class="sg">
<div> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Jonathan</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
</span></div><div><blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"></blockquote></div><div><span class="q">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">----- Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="myan@umich.edu" href="mailto:myan@umich.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Muk Yan</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b> <a title="dev101@magma.ca" href="mailto:dev101@magma.ca" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Jonathan</a> </div></span></div><div><span class="e" id="q_10d1de23b480088e_4">
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Cc:</b> <a title="zope@zope.org" href="mailto:zope@zope.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
zope@zope.org</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b> Thursday, August 17, 2006 4:40
PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><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><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> <<a href="mailto:dev101@magma.ca" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
dev101@magma.ca</a>> wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div bgcolor="#ffffff">
<div><font face="Arial" size="2">What does "it doesn't seem to work" mean?
Error messages/traceback? What does your form & script contain?
More info on the problem is definitely required!</font></div></div>
<div><span>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Jonathan</font></div></span></div>
<div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"></blockquote></div>
<div><span>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="myan@umich.edu" href="mailto:myan@umich.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Muk Yan</a> </div></span></div>
<div><span>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a title="dev101@magma.ca" href="mailto:dev101@magma.ca" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Jonathan</a> ; <a title="zope@zope.org" href="mailto:zope@zope.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
zope@zope.org</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Thursday, August 17, 2006 4:20 PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; 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. 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> <<a href="mailto:dev101@magma.ca" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">dev101@magma.ca</a>> wrote:
</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<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> </div>
<div><font face="Arial" size="2">REQUEST =
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> </div>
<div><font face="Arial" size="2">fname = REQUEST['first_name']</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2"></font> </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> </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> </div>
<div><font face="Arial"><font size="2">or</font></font></div>
<div><font face="Arial"><font size="2"></font></font> </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> </div>
<div><font face="Arial"><font size="2"></font></font> </div>
<div><font face="Arial"><font size="2">hth</font></font></div>
<div><font face="Arial"><font size="2"></font></font> </div>
<div><font face="Arial"><font size="2">Jonathan</font></font></div>
<div><font face="Arial"><font size="2"></font></font> </div>
<blockquote style="border-left: 2px solid rgb(0, 0, 0); padding-right: 0px; padding-left: 5px; margin-left: 5px; margin-right: 0px;"></blockquote></div>
<div><span>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">-----
Original Message ----- </div>
<div style="background: rgb(228, 228, 228) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<b>From:</b>
<a title="myan@umich.edu" href="mailto:myan@umich.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Muk Yan</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>To:</b>
<a title="zope@zope.org" href="mailto:zope@zope.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">zope@zope.org</a> </div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"><b>Sent:</b>
Thursday, August 17, 2006 2:57 PM</div>
<div style="font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; 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><form
action="process_this_form" method="post"<br><br>Name:<input type="text"
name:"first_name"><br><br></form> <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><dtml-call "REQUEST.SESSION.set ('firstName',
first_name)><br><dtml-call
"this_is_a_python_script()"><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 <dtml-call "
REQUEST.SESSION.set('firstName', first_name)> and then
REQUEST.SESSION.get('firstName') in the python script. Sort of a
sophomoric question, but any help would be appreciated. Thanks in
advance.<br><br>-Muk<br></span></div>
<div>
<p></p>
<hr>
<p></p>_______________________________________________<br>Zope
maillist - <a href="mailto:Zope@zope.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Zope@zope.org</a><br><a href="http://mail.zope.org/mailman/listinfo/zope" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.zope.org/mailman/listinfo/zope</a><br>**
No cross posts or HTML encoding! **<br>(Related lists - <br> <a href="http://mail.zope.org/mailman/listinfo/zope-announce" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.zope.org/mailman/listinfo/zope-announce
</a><br> <a href="http://mail.zope.org/mailman/listinfo/zope-dev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
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></span></div><div></div>
</div></blockquote></div><br>