FW: [Zope] Form processing in Zope

Kevin Teague kevin@bud.ca
Fri, 30 Mar 2001 03:42:35 -0800


There are two ways around avoiding the <dtml-if "ActionList == 1"> NameError
problem that I know of:

1. Wrap your if statements with another if statement:

<dtml-if ActionList>
<dtml-if expr="ActionList == 1">
Do this
<dtml-elif expr="ActionList == 2">
Do that.
</dtml-if>
</dtml-if>

2. At the top of your script, if an form value expected by your script
doesn't exist, set it to something:

<dtml-unless ActionList>
<dtml-var "REQUEST.set('ActionList','some_default_value')">
</dtml-unless>


> 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

>>>>>>> 
>>>>>>> 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.


Kevin Teague
http://www.bud.ca