<dtml-if> newbie question
I want to select from a select menu, 3 amounts: 1000, 5000 or 10000. 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 10000 was selected Now my form method looks like this: <form action="form_action"> How many money? <select name="money"> <option>1000 <option>5000 <option>10000 </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 "10000"> 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.
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 geirh@funcom.com 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 10000. 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 10000 was selected SG> Now my form method looks like this: SG> <form action="form_action"> SG> How many money? SG> <select name="money"> SG> <option>1000 SG> <option>5000 SG> <option>10000 SG> </select> SG> <input type="submit" value="checkit"> SG> </form> SG> and the form_action method is this: SG> <dtml-in money> SG> <dtml-if "1000"> SG> This is not much! SG> </dtml-if> SG> <dtml-if "5000"> SG> This is ok! SG> </dtml-if> SG> <dtml-if "10000"> 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 - Zope@zope.org 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 )
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="#000000"><b>You 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 10000. 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 10000 was selected
Now my form method looks like this:
<form action="form_action"> How many money? <select name="money"> <option>1000 <option>5000 <option>10000 </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 "10000"> 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 - 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 )
* Stephan Goeldi <stephan_goeldi@hotmail.com> [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 "10000"> 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==10000"> This is very much <dtml-else> This is not 1000, 5000, or 10000 </dtml-if> the <dtml-in> tag iterates over a list, which isn't appropriate here. seb
HI!
I want to select from a select menu, 3 amounts: 1000, 5000 or 10000. 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 10000 was selected
Now my form method looks like this:
<form action="form_action"> How many money? <select name="money"> <option>1000 <option>5000 <option>10000 </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 "10000"> 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=='10000'"> 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 cs@comlounge.net
Hi all, I'm trying to display the column names of a Record object without success. I'm able to access column data using sequence-item but I don't know how to display column names. <dtml-var standard_html_header> <dtml-in "desc(cmd=cmd_sql)" size=50 start=query_start> <dtml-if sequence-start> <dtml-if previous-sequence> <A HREF="<dtml-var URL><dtml-var sequence-query>query_start=<dtml-var previous-sequence-start-number>">(Previous <dtml-var previous-sequence-size> results)</A> </dtml-if previous-sequence> <TABLE> <TR><TH>?????????????HEADER????????????</TH></TR> </dtml-if sequence-start> <TR> <dtml-in sequence-item> <TD BGCOLOR="WHITE"><dtml-var sequence-item null="NULL"></TD> </dtml-in> </TR> <dtml-if sequence-end> </TABLE> <dtml-if next-sequence> <A HREF="<dtml-var URL><dtml-var sequence-query>query_start=<dtml-var next-sequence-start-number>"> (Next <dtml-var next-sequence-size> results)</A> </dtml-if next-sequence> </dtml-if sequence-end> <dtml-else> There was no data matching this <dtml-var title_or_id> query. </dtml-in> <dtml-var standard_html_footer> Thanks for any help José
On Tue, 14 Nov 2000, Jose Soares wrote:
Hi all,
I'm trying to display the column names of a Record object without success. I'm able to access column data using sequence-item but I don't know how to display column names.
Here is some code I use in a production site: <dtml-let Fields="sqlQuery().names()"> <dtml-in Fields> do your loop stuff here </dtml-in> </dtml-let> I only used the dtml-let because I use the list twice... so; <dtml-in "sqlQuery().names()"> blah </dtml-in> should work fine (not testsed.) I believe there is some more detail in what exactly is in an SQL return object (try the ZQR :)
Thanks for any help José
Have a better one, Curtis Maloney
Great! Thank you very much Curtis. Curtis Maloney wrote:
On Tue, 14 Nov 2000, Jose Soares wrote:
Hi all,
I'm trying to display the column names of a Record object without success. I'm able to access column data using sequence-item but I don't know how to display column names.
Here is some code I use in a production site:
<dtml-let Fields="sqlQuery().names()"> <dtml-in Fields> do your loop stuff here </dtml-in> </dtml-let>
I only used the dtml-let because I use the list twice... so;
<dtml-in "sqlQuery().names()"> blah </dtml-in>
should work fine (not testsed.) I believe there is some more detail in what exactly is in an SQL return object (try the ZQR :)
Thanks for any help José
Have a better one, Curtis Maloney
_______________________________________________ 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 )
participants (7)
-
cs@comlounge.net -
Curtis Maloney -
Geir B�kholt -
Jose Soares -
Paul Zwarts -
seb bacon -
Stephan Goeldi