[ZPT] DTML-ZPT help

Jadran Prodan (E-mail) jadran.prodan@mtt-solutions.si
Fri, 13 Jul 2001 08:57:32 +0200


Hi,

Combination form page, answer page, script in DTML works but I have problem
to translete it to ZPT.
Thanks.

Lp, Jadran

--------------------------------
---- DTML version ------
-------------------------------
-----add_form.html------
<html>
  <head></head>
  <body>
   <h1> Vnos novega ...   </h1>
  <form action="xxx_action.html" method="POST">
	<p>         Naslov :<br>
          		<textarea name="Naslov" rows="3" cols="60"></textarea>
	</p>
	<p>
        		Opis :<br>
          		<textarea name="Opis" rows="10" cols="60"></textarea>
        	</p>
	<p>
          		<input type="submit" value="Poslji ...">
        	</p>
        </form>
  </body>
</html>
------xxx_action.html-------
<dtml-var standard_html_header>
        <dtml-call expr="addEntry(Naslov, Opis)">
        <h1>Uspesen vnos.</h1>
<dtml-var standard_html_footer>
-----addEntry-----------
------ parameters: naslov, opis

        # create a unique document id
        id='entry_%d' % len(context.objectIds())

        # create the document
        context.manage_addProduct['OFSP'].manage_addDTMLDocument(id,
                                                 title=naslov, file=opis)
--------------------------------
---- ZPT version ------
-------------------------------
-----add_form.html------
<html>
  <head></head>
  <body>
   <h1> Vnos novega ...   </h1>
  <form action="add_action.html" method="POST">
	<p>         Naslov :<br>
          		<textarea name="Naslov" rows="3" cols="60"></textarea>
	</p>
	<p>
        		Opis :<br>
          		<textarea name="Opis" rows="10" cols="60"></textarea>
        	</p>
	<p>
          		<input type="submit" value="Poslji ...">
        	</p>
        </form>
  </body>
</html>
------add_action.html-------
<html>
  <head>
    <title tal:content="template/title">The title</title>
  </head>
  <body>

<h1 tal:define="nic python:here/addEntry(request/Naslov , request/Opis)">
                     Uspesen vnos.</h1>

    <div>
    Dodan je bil "<span tal:content="request/Naslov">naslov ...</span>" z
sledečim opisom:<br>
    <span tal:content="request/Opis">
      opis ...
    </span>
    </div>
</body>
</html>
-----addEntry-----------
------ parameters: naslov, opis

        # create a unique document id
        id='entry_%d' % len(context.objectIds())

        # create the document
        context.manage_addProduct['OFSP'].manage_addDTMLDocument(id,
                                                 title=naslov, file=opis)
--------------------------------