[Zope-DB] Formulator issue with Z Search Interface (Was: Form evaluation in ZSQL-Method)

Andreas Tille tillea at rki.de
Wed Sep 24 03:46:50 EDT 2003


On Tue, 23 Sep 2003, Dieter Maurer wrote:

> Anyway, I attach a patch to fix the "Z Search Interface".
Any further hint if I use Formulator?  The patch worked for my simple
example but my real application uses Formulator.  If I enhance my simple
example by a Formulator object the initial problem raises up again:


   Zope Error

   Zope has encountered an error while publishing this resource.

   Error Type: NameError
   Error Value: global name 'field_iditem' is not defined

Or should I discuss this issue on a Formulator related list?

Kind regards

          Andreas.

Here the relevant objects created by the (patched) Z Search Interface:

search.html:

    <html>
    <head>
     <title tal:content="template/title">The title</title>
    </head>
    <body>
    <form name="form" method="post" action="report.html" method="get">
    <table tal:define="form here/form" align=center>
     <tr>
      <th>iditem:</th>
       <td tal:define="iditem request/iditem|nothing">
           <input tal:replace="structure python:form.iditem.render(iditem)"></td>
    </tr>
    <tr>
     <td colspan=2 align=center>
      <input type="SUBMIT" name="SUBMIT" value="Submit Query">
     </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

report.html:

    <html><body>
    <html>
      <body tal:define="results  here/test;
                        start request/start|python:0;
                        batch python:modules['ZTUtils'].Batch(results,
                                                              size=20,
                                                              start=start);
                        previous python:batch.previous;
    		    pfirst previous/first | nothing;
                        next python:batch.next;
    		    nfirst next/first | nothing;
    		    url_query nocall:modules/ZTUtils/url_query;
    		    ">

      <p>
        <a tal:condition="previous"
           tal:attributes="href python:url_query(request,omit='start') + '&start:int=%s' % pfirst"
           href="previous_url">previous <span tal:replace="previous/length">20</span> results</a>
        <a tal:condition="next"
           tal:attributes="href python:url_query(request,omit='start') + '&start:int=%s' % nfirst"
           href="next_url">next <span tal:replace="next/length">20</span> results</a>
      </p>

      <table border>
            <tr>
              <th>Iditem</th>
              <th>Item</th>
            </tr>

      <div tal:repeat="result batch" >

             <tr>
              <td><span tal:replace="result/iditem">iditem goes here</span></td>
              <td><span tal:replace="result/item">item goes here</span></td>
            </tr>

      </div>

          </table>
      <p>
        <a tal:condition="previous"
           tal:attributes="href python:url_query(request,omit='start') + '&start:int=%s' % pfirst"
           href="previous_url">previous <span tal:replace="previous/length">20</span> results</a>
        <a tal:condition="next"
           tal:attributes="href python:url_query(request,omit='start') + '&start:int=%s' % nfirst"
           href="next_url">next <span tal:replace="next/length">20</span> results</a>
      </p>

      </body>
    </html>

    </body></html>




More information about the Zope-DB mailing list