Hi, a problem could arrise, if the content of "ActionList" is evaluated to "false" eg, if it contains 0 or empty string and so on. In your case, Gitte, there schould be no problem. But think about this if you write other forms :-) One way is to check if the submit-button has been sent: <form method="POST"> ... <input type="submit" name="sent_form" value="OK"> </form> So you can test for the existence of "sent_form". Note: never use the value of the submit-button if possible. (this is an issue with localisation) Note2: try to not explicitely link to index_html. This is a method of the container-object and it is its default method if you just call the object itself via web. In most cases not specifying the "action" attribute of the form tag should fit. Regards Tino Phil Harris wrote:
Testing for existence is even easier than you think:
<dtml-if ActionList> <dtml-if expr="ActionList == '1'"> Do this <dtml-elif expr="ActionList == '2'"> Do that. </dtml-if> <dtml-else> ActionList not yet set. </dtml-if>
Phil
----- Original Message ----- From: "Gitte Wange" <gitte@babytux.dk> To: "Phil Harris" <phil.harris@zope.co.uk> Cc: <zope@zope.org> Sent: Friday, March 30, 2001 12:28 PM Subject: Re: [Zope] Form processing in Zope
On 30 Mar 2001 12:23:51 +0100, Phil Harris wrote:
Gitte,
try putting this
<dtml-var REQUEST>
into your page, and see what form variables are being returned.
phew it gives a lot !
But I discovered one thing: When you enter the site, there is no variable named ActionList, but when you hit the submit button there is a ActionList with value=1
hmm .. what now? I need to test for that variable but it has to be declared before running the script. Has anyone had these kinds of problems ?
Gitte
----- Original Message ----- From: "Gitte Wange" <gitte@babytux.dk> To: "Phil Harris" <phil.harris@zope.co.uk> Cc: <zope@zope.org> Sent: Friday, March 30, 2001 12:19 PM Subject: Re: [Zope] Form processing in Zope
On 30 Mar 2001 12:17:08 +0100, Phil Harris wrote:
What happens if tyou do <dtml-var ActionList>
I get a NameError
Well action of the form is set to index_html Can't I do that ?
Because if I should make a method that recieves the value of the ActionList, then I need to get that value back to index_html to find
out
which selectbox to display next
Gitte
----- Original Message ----- From: "Gitte Wange" <gitte@babytux.dk> To: "Phil Harris" <phil.harris@zope.co.uk> Cc: <zope@zope.org> Sent: Friday, March 30, 2001 12:10 PM Subject: Re: [Zope] Form processing in Zope
On 30 Mar 2001 12:06:05 +0100, Phil Harris wrote: > Why don't you try this? > > <dtml-if expr="ActionList == '1'"> > Do this > <dtml-elif expr="ActionList == '2'"> > Do that. > </dtml-if> > > Notice the single quotes around '1' and '2', if you didn't coerce the > variables already then they're going to come in as strings. > > Phil
Then I get a NameError
Gitte
> > > > > ----- Original Message ----- > From: "Gitte Wange" <gitte@babytux.dk> > To: "Phil Harris" <phil.harris@zope.co.uk> > Cc: <zope@zope.org> > Sent: Friday, March 30, 2001 12:00 PM > Subject: Re: [Zope] Form processing in Zope > > > > Believe it or not - I actually understand so far :-) > > > > Now I only have one problem. > > > > I need to test on the value from the select box, eg: > > The selectbox is names ActionList. > > > > <dtml-if expr="ActionList == 1"> > > Do this > > <dtml-elif expr="ActionList == 2"> > > Do that. > > > > But when I say <dtml-id expr="<dtml-var ActionList> == 1"> > > I get a syntax error. > > > > Help ? > > > > Gitte > > > > > > On 30 Mar 2001 11:38:47 +0100, Phil Harris wrote: > > > Zope works exactly that way. > > > > > > It creates entries into the REQUEST variable, which by the wonders of > > > namespaces/acquisition can be used in the current namespace. > > > > > > So in your example doing <dtml-var Name> will put the value of the Name > form > > > entry into your html output. > > > > > > hth > > > > > > Phil > > > > > > > > > ----- Original Message ----- > > > From: "Gitte Wange" <gitte@mmmanager.org> > > > To: <zope@zope.org> > > > Sent: Friday, March 30, 2001 11:17 AM > > > Subject: [Zope] Form processing in Zope > > > > > > > > > > Hello, > > > > > > > > I have now found out that my problem isn't just a select box in Zope, > > > > but it is all form processing. > > > > > > > > I am mostly a PHP programmer so I am used to when you make a text > field > > > > in a form named e.g. Name it will (when you have hit the submit button > > > > and the script you have set as actionscript receives the form) be > > > > declared as a variable named Name. > > > > > > > > But I guess Zope doesn't work this way. > > > > > > > > So how does a dtml document recieve the fields in a form ? > > > > > > > > Regards, > > > > > > > > -- > > > > ************************ > > > > Gitte Wange Jensen > > > > > > > > System Squid Developer > > > > MMManager Aps > > > > +45 29 72 79 72 > > > > > > > > gitte@mmmanager.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 ) > > > > > > > > > _______________________________________________ > > > 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 ) > > > > > > > > -- > > ************************ > > Gitte Wange Jensen > > > > System Squid Developer > > MMManager Aps > > +45 29 72 79 72 > > > > gitte@mmmanager.org > > ************************
-- ************************ Gitte Wange Jensen
System Squid Developer MMManager Aps +45 29 72 79 72
gitte@mmmanager.org ************************
-- ************************ Gitte Wange Jensen
System Squid Developer MMManager Aps +45 29 72 79 72
gitte@mmmanager.org ************************
-- ************************ Gitte Wange Jensen
System Squid Developer MMManager Aps +45 29 72 79 72
gitte@mmmanager.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 )