Re: [Zope] dtml-if newbie question

2000-11-09 Thread Geir Bækholt


possibly not the cleanest way of doing it, but this ought to do what
you want..

select name="money:int"
option value="1000"1000
option value="5000"5000
.. etc..

and

dtml if "money == 1000"
 This is not much!
dtml-elif "money == 5000"
 This is ok!
dtml-elif ..

etc..
/dtml-if


--
Geir Bækholt
web-developer/designer
[EMAIL PROTECTED]
http://www.funcom.com


on Thursday, November 09, 2000 Stephan Goeldi wrote :
SG I want to select from a select menu, 3 amounts: 1000, 5000 or 1. After 
SG this, the form action method should reply:

SG - "this is not much" if 1000 was selected,
SG - "this is ok" if 5000 was selected,
SG - "this is very much" if 1 was selected

SG Now my form method looks like this:

SG form action="form_action"
SG How many money?
SG select name="money"
SG option1000
SG option5000
SG option1
SG /select
SG input type="submit" value="checkit"
SG /form

SG and the form_action method is this:

SG dtml-in money
SGdtml-if "1000"
SG   This is not much!
SG/dtml-if
SGdtml-if "5000"
SG   This is ok!
SG/dtml-if
SGdtml-if "1"
SG   This is very much!
SG/dtml-if
SG /dtml-in

SG I am sure that there is an error in my thinking of these tags.

SG TIA
SG -goe-

SG _
SG Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

SG Share information about yourself, create your own public profile at 
SG http://profiles.msn.com.


SG ___
SG Zope maillist  -  [EMAIL PROTECTED]
SG http://lists.zope.org/mailman/listinfo/zope
SG **   No cross posts or HTML encoding!  **
SG (Related lists - 
SG  http://lists.zope.org/mailman/listinfo/zope-announce
SG  http://lists.zope.org/mailman/listinfo/zope-dev )



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




RE: [Zope] dtml-if newbie question

2000-11-09 Thread hohage

Hallo Stephan
you can't iterate over a string!
That's working:
dtml-if "money=='1000'"
 This is not much!
 dtml-elif "money=='5000'"
 This is ok!
 dtml-else
 This is very much!
 /dtml-if





___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] dtml-if newbie question

2000-11-09 Thread Paul Zwarts

Another thing you can do, not sure if Im using it right, but the effect is
good...

   dtml-unless first_name
  dtml-raise type=ValidationError
font face="Arial, Helvetica, sans-serif" size="-1"
color="#00"bYou must specify a font color="red"First Name/b/font.

/font
  dtml-var tableSeparate
  dtml-var SupportCallForm
  /dtml-raise
   /dtml-unless

I have a support call form that is filed and submitted, and after the button
is pressed, a seperate validate method is called (can be in any document)
which will stop the processing if something isnt there and will show a red
error text at the top of the form that still contains the information.]

Its nice becuase the info stays there and doesnt take you off to a blank
screen with a few words.



--
Paz
Oratrix Development BV
http://www.oratrix.com
GRiNS SMIL Editor
-


Stephan Goeldi wrote:

 I want to select from a select menu, 3 amounts: 1000, 5000 or 1. After
 this, the form action method should reply:

 - "this is not much" if 1000 was selected,
 - "this is ok" if 5000 was selected,
 - "this is very much" if 1 was selected

 Now my form method looks like this:

 form action="form_action"
 How many money?
 select name="money"
 option1000
 option5000
 option1
 /select
 input type="submit" value="checkit"
 /form

 and the form_action method is this:

 dtml-in money
dtml-if "1000"
   This is not much!
/dtml-if
dtml-if "5000"
   This is ok!
/dtml-if
dtml-if "1"
   This is very much!
/dtml-if
 /dtml-in

 I am sure that there is an error in my thinking of these tags.

 TIA
 -goe-

 _
 Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

 Share information about yourself, create your own public profile at
 http://profiles.msn.com.

 ___
 Zope maillist  -  [EMAIL PROTECTED]
 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  -  [EMAIL PROTECTED]
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 )




Re: [Zope] dtml-if newbie question

2000-11-09 Thread seb bacon

* Stephan Goeldi [EMAIL PROTECTED] [001109 16:49]:
 dtml-in money
dtml-if "1000"
   This is not much!
/dtml-if
dtml-if "5000"
   This is ok!
/dtml-if
dtml-if "1"
   This is very much!
/dtml-if
 /dtml-in
 
 I am sure that there is an error in my thinking of these tags.

yup :)

try

  dtml-if "money==1000"
This is not much
  dtml-elif "money==5000"
This is OK
  dtml-elif "money==1"
This is very much
  dtml-else
   This is not 1000, 5000, or 1
  /dtml-if

the dtml-in tag iterates over a list, which isn't appropriate here.

seb

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] dtml-if newbie question

2000-11-09 Thread Christian Scholz

HI!

 I want to select from a select menu, 3 amounts: 1000, 5000 or 1. After 
 this, the form action method should reply:
 
 - "this is not much" if 1000 was selected,
 - "this is ok" if 5000 was selected,
 - "this is very much" if 1 was selected
 
 Now my form method looks like this:
 
 form action="form_action"
 How many money?
 select name="money"
 option1000
 option5000
 option1
 /select
 input type="submit" value="checkit"
 /form
 
 and the form_action method is this:
 
 dtml-in money
dtml-if "1000"
   This is not much!
/dtml-if
dtml-if "5000"
   This is ok!
/dtml-if
dtml-if "1"
   This is very much!
/dtml-if
 /dtml-in
 
 I am sure that there is an error in my thinking of these tags.

The dtml-in is not right. Use dtml-in if you want to iterate over
lists. So in your case you should try:


dtml-if "money=='1000'"
This is not much!
/dtml-if
dtml-if "money=='5000'"
This is ok!
/dtml-if
dtml-if "money=='1'"
This is very much!
/dtml-if

(or use dtml-elif in this case)

This now makes a string compare as usually form parameters will be passed
as strings if you don't tell Zope to do it different. In order to e.g. let
it pass integers, you might try in the form:

select name="money:int"
...

Then you can say dtml-if "money==1000", etc.

More information about this "type casting" feature can be found at

http://classic.zope.org:8080/Documentation/Reference/ORB

cheers,
  Christian

-- 
COM.lounge  http://comlounge.net/
communication  design   [EMAIL PROTECTED]

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] dtml-if newbie question

2000-11-09 Thread Dieter Maurer

Stephan Goeldi writes:
  ...
  select name="money"
  
  /select
  ...
  and the form_action method is this:
  
  dtml-in money
"money" will come in as a string value not as a list.
It would be a list, if you added a "multiple" to your
"select".
 dtml-if "1000"
This will always be true. It is constant (an expression without
variable, having always the same value independent of context).

What you mean is:

  dtml-if "money == '1000'"

This will be true, if "money" has the value "'1000'" in the current
context.

Note the '...' around 1000! Without special Zope magic, request
variables come in as string values. The '...' indicates
a string literal.

You want to look at the upcoming Zope book to learn more
about the possible Zope magic.


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
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 )