> -----Original Message-----
> From: Lennart Regebro [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 19, 2005 11:07 AM
> Cc: J Cameron Cooper; zope@zope.org
> Subject: Re: [Zope] How to make a ZPT-based form that calls itself? (Part
> II)
> On 5/19/05, Ken Winter <[EMAIL PROTECTED]> wrote:
> > * I assume you include data retrieved from (and updated in) an
> underlying
> > relational database.
> >
> > * Does "data" also include parameters (or arguments, or query string
> > variables, or whatever you call them) passed from one HTML page to the
> next?
> Sure.
> > This parameter-passing is what I seem to be having trouble with.  How
> does
> > that script get the info it needs from the previous page?  In my
> example,
> > when my "personform.htm" updates a record and then re-calls itself, how
> does
> > it get the person_id identifying the record it's supposed to display the
> > second time around?
> You put it in a hidden input-field.
That's what I've been doing (I think), and it's not working.  Let me paste
in a listing of the whole <div> tag that I'm using (with some irrelevant
bits clipped out):

<div tal:repeat="person
<table height="fit" width="fit" border="0" align="left" cellpadding="0"
  <tr height="fit"> 
                <td width="fit" align="left"> <em><strong> 
            <font size="+2"><p align="left" tal:content="string:
${person/first_name} ${person/middle_names} ${person/last_name}">Name
        <form name="form1" id="form1" method="post"
          <table width="fit" border="0" cellspacing="0" cellpadding="0">
  <tr height="fit">
    <td width="fit" align="right"><em>&nbsp;&nbsp;First
    <td width="fit"><input type="text" name="first_name" value=""
tal:attributes="value string:${person/first_name}"/></td>
  <tr height="fit">
    <td width="fit" align="right"><em>&nbsp;&nbsp;Middle
    <td width="fit"><input type="text" name="middle_names" value=""
tal:attributes="value string:${person/middle_names}"/></td>
  <tr height="fit">
    <td width="fit" align="right"><em>&nbsp;&nbsp;Last Name:&nbsp;</em></td>
    <td width="fit"><input type="text" name="last_name" value=""
tal:attributes="value string:${person/last_name}"/></td>
<input type="hidden" name="person_id" value="" tal:attributes="value
            <input type="submit" name="Submit" value="Save Changes" />
            <input type="reset" name="Reset" value="Cancel Changes" />

The tal:repeat in the first line is my attempt to grab all my data at the
start.  The hidden input field at the bottom is my attempt to pass the
person_id along when the page is trying to re-call itself.  The whole thing
works OK when the page is called from elsewhere, passing the person_id in
the form of a URL argument string along these lines:
"personform.htm?person_id=35".  But it doesn't work when the Python script "
update_person_py()" called by "personform.htm" itself tries to re-call
"personform.htm", trusting the hidden field to convey the person_id data.
Instead, the data update is performed but the next thing the browser shows
is an AttributeError=person_id.  The body of the "update_person_py" script

id = context.REQUEST.get('person_id')
if id:

What's wrong with this picture?

- Thanks again, Ken

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to