[Zope] dtml-in and namespaces

Jens Vagelpohl jens@digicool.com
Sat, 14 Apr 2001 11:16:53 -0400


try something like...


<dtml-in required>
   Checking: <dtml-var sequence-item><br>
   <dtml-unless "REQUEST.get(_['sequence-item'], '')">
      <dtml-call "REQUEST.set('finished','false')">
       Missing: <dtml-var sequence-item><br>
   </dtml-unless>
</dtml-in>


this way the unless tests if the field name is available in the REQUEST and
if not will return an empty string, meaning the unless condition will
evaluate to false. The same will happen if the name is in the REQUEST but
empty.

jens




On 4/13/01 16:52, "Frank Tegtmeyer" <ftelist@lightwerk.com> wrote:

> Hi,
> 
> I am mentally blocked now in getting something simple (I assume) to work.
> 
> I want to check if all required fields in a form are filled - simply the
> presence of data is to be checked for now.
> 
> My form processing is included in a <dtml-let> statement that defines
> the form variables and the descriptive names. Also the required fields
> are defined here.
> 
> I want to check the required fields within a <dtml-in> statement. There I
> cannot access the fieldnames directly because my test would never fail:
> 
> <dtml-let fields="{'m_email':'Email-Adresse',
>                  'm_vorname':'Vorname',
>                  ...
>                  'm_plz':'Postleitzahl'
>                  }"
>     required="['m_email','m_vorname','m_nachname']"
>> 
> <dtml-if expr="REQUEST.REQUEST_METHOD=='POST'">
> <dtml-call "REQUEST.set('finished','true')">
> 
> <dtml-in required>
>      Checking: <dtml-var sequence-item><br>
>      <dtml-unless ????????????????>
>         <dtml-call "REQUEST.set('finished','false')">
>          Missing: <dtml-var sequence-item><br>
>      </dtml-unless>
> </dtml-in>
> 
> <dtml-if "REQUEST.get('finished')=='true'">
> ...
> </dtml-let>
> 
> 
> What has to be used in <dtml-unless>? Is there a better/simpler way to
> check the presence of required data?
> 
> Form processing is such a basic requirement - ther must be hundreds out
> there that can answer my question :)
> 
> Many thanks in advance!
> 
> Regards, Frank
> 
> _______________________________________________
> 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 )
>