[Zope] Using results of SQL in form

Ryan M. Dolensek rdolense@globalcrossing.com
Tue, 06 Feb 2001 12:33:13 -0600


try ...

<dtml-var "getVideoSQL(pCode=pCode)">

hope that helps :-)
ryan

Ben Edwards wrote:

> I have a Z SQL Method which returns one row and I want to use the data from
> it in a form (I am going to detault the input fields with the values from
> the SQL).  I thought using the dtml-in tag would be a simple way of doing
> this but am having problems passing the method the parameter.  In the code
> below the line
>
>    Edit Video <dtml-var pCode>
>
> renders pCode into the page but the line
>
>    <dtml-in expr="getVideoSQL(pCode)">
>
> generates a runtime error saying pCode not found.
>
> Can anyone advise me as to what I ma doing wrong?
>
> Regards,
> ben
>
> editVideo DHTML Method:
> <dtml-var standard_html_header>
> <dtml-var table_top>
> Edit Video <dtml-var pCode>
> <dtml-var table_middle>
> <dtml-in expr="getVideoSQL(pCode)">
> <form action="addVideoMethod">
>    <table width="100%" border="0" cellspacing="0" cellpadding="0">
>      <tr valign="middle" align="left">
>        <td class="NormalText">
>          <div align="right"><b>Code:</b></div>
>        </td>
>        <td class="NormalText" colspan="3">
>          <input type="text" name="code" size="7">
>          <b>Titile:</b>
>          <input type="text" name="title" size="20">
>        </td>
>      </tr>
>      <tr valign="top">
>        <td class="NormalText" width="100">
>          <div align="right"><b>Abstract:</b></div>
>        </td>
>        <td class="NormalText" colspan="3">
>          <textarea name="abstract" cols="30" rows="3"></textarea>
>        </td>
>      </tr>
>      <tr valign="top">
>        <td class="NormalText" width="100">
>          <div align="right"><b>Desc:</b></div>
>        </td>
>        <td class="NormalText" colspan="3">
>          <textarea name="description" cols="30" rows="8"></textarea>
>        </td>
>        </tr>
>        <tr valign="top" align="left">
>          <td class="NormalText">
>            <div align="right"><b>Producer:</b></div>
>          </td>
>          <td class="NormalText" colspan="3" valign="middle">
>            <input type="text" name="author" size="15">
>            <b>Duration: </b>
>            <input type="text" name="duration_hours" size="3"><b>:</b>
>            <input type="text" name="duration_minutes" size="3">
>          </td>
>        </tr>
>        <tr valign="middle">
>          <td class="NormalText" width="100">
>            <div align="right"><b>Price:</b></div>
>          </td>
>          <td class="NormalText" colspan="3">
>          <p><input type="text" name="price" size="10"></p>
>        </td>
>      </tr>
>      <tr valign="top">
>        <td class="NormalText" width="100"><b></b></td>
>        <td class="NormalText" colspan="3">
>          <input type="submit" name="Submit" value="Submit">
>          <input type="reset" name="Submit2" value="Reset">
>        </td>
>      </tr>
>    </table>
> </form>
> </dtml-in>
> <dtml-var table_bottom>
> <dtml-var standard_html_footer>
>
> getVideoSQL Z SQL Method with paramater pCode:
> select * from products where code=<dtml-sqlvar pCode type="string">
> *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
> * Ben Edwards lostit@videonetwork.org    +44 (0)7970 269 522 *
> * Campaign Against proper English, Dyslexia division         *
> * Homepage                http://www.gifford.co.uk/~bedwards *
> * i-Contact Progressive Video    http://www.videonetwork.org *
> * Smashing the Corporate image     http://www.subvertise.org *
> * Bristol's radical news            http://www.bristle.co.uk *
> * Open Directory Project                 http://www.dmoz.org *
> *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

--
Ryan Dolensek
Software Engineer
Global Crossing
(920)405-4812
rdolense@globalcrossing.com