[Zope] dtml-if question

Wolfram Kerber wk@gallileus.de
Mon, 3 Dec 2001 08:01:52 +0100


sorry, still a bit early ... second try:

the form:

<form name="stuff" action="b">
<input type="checkbox" name="my_items:list" value="item1">Item 1 <BR>
<input type="checkbox" name="my_items:list" value="item2">Item 2 <BR>
<input type="submit">
</form>

--- version1---

page b:

<dtml-if my_items>
<dtml-in "sql_process(my_items=my_items)">
do something
</dtml-in>
<dtml-else>
no selected item
</dtml-if>

sql_process:

select * from my_table where Name in my_items

--- version2---

page b:

<dtml-if my_items>
<dtml-in sql_process>
<dtml-if "name_of_column in my_items">
  Exists.
<dtml-else>
  Does not exist.
</dtml-if>
</dtml-in>

<dtml-else>
no selected item
</dtml-if>

I don't know SQL so you should better read:
http://www.zope.org/Members/michel/ZB/RelationalDatabases.dtml

I would recommend reading the zope book anyway.

hope this helps,

Wolfram


----- Original Message -----
From: "Kyroraz" <kyroraz@cableaz.com>
To: "Wolfram Kerber" <wk@gallileus.de>; <zope@zope.org>
Sent: Monday, December 03, 2001 7:02 AM
Subject: Re: [Zope] dtml-if question


> Thanks for the reply ...
>
> but I don't think this is quite what I am going for....
>
> Assume that I have two webpages, page A and page B...
>
> Page A is a form-filled page:
>
> <form name="stuff" action="b">
> <input type="checkbox" name="item1">Item 1 <BR>
> <input type="checkbox" name="item2">Item 2 <BR>
> <input type="submit">
> </form>
>
> Page B contains the code to look in a SQL database.  Inside this
> database, one of the columns contains information in relation to item1
> and item2 that has to be set in "b" somehow.  If the user selects
> checkbox 1, item1 will be defined.  Likewise for item2.  Both can be set
> as well.
>
> <dtml-in sql_process>
> <dtml-if <dtml-var
check_to_see_if_this_column_exists_with_the_passed_form>>
>   Exists.
> <dtml-else>
>   Does not exist.
> </dtml-if>
> </dtml-in>
>
> I need the value of
> check_to_see_if_this_column_exists_with_the_passed_form parsed so that
> the dtml-if can "see" it....
>
> If the table contains
>
> Name | Value | ...
>
> item1   50
> item2   75
>
> And replace that long
> check_to_see_if_this_column_exists_with_the_passed_form with name, for
> example, it should go through the table, see "name" and then try to see
> if "item1" was passed from the form.
>
> Tricky.
>
> Jason
>
>
>
> Wolfram Kerber wrote:
>
> ><dtml-if <dtml-var
> >  important_column_that_may_exist_also_as_a_passed_variable> >
> >
> >should read:
> >
> ><dtml-if  important_column_that_may_exist_also_as_a_passed_variable>
> >
> >and don't forget to close the dtml-in loop with </dtml-in>
> >
> >
> >Wolfram
> >
> >
>
>
>