Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 17th, 2002, 06:32 AM
mutinda mutinda is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: kenya
Posts: 0 mutinda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation python functions in dtml

Hi guys.

I am a severe rookie (newbie) in the Zope/python enviroment. I therefore need some help on calling python functions in dtml code. I typed the following in one of my pages but to no avail:

<input type="text" value="<dtml-call expr="pyFeedback.doTotal('text1','text2')">" name="total:int:ignore_empty"> </td>

The function as you can see is called doTotal and it basically is supposed to display the sum of 2 values in text boxes. Am I on the right track?

Rookie pythoneer.

Reply With Quote
  #2  
Old September 18th, 2002, 06:40 PM
ZeUs's Avatar
ZeUs ZeUs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: St. George, Utah
Posts: 63 ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 36
If you want the result of a Python expression put in place of your dtml tag, you need to use dtml-var. dtml-call evaluates an expression, but does not put the result of that expression into the rendered page.


Fixed code:

Code:
<input type="text" value="<dtml-var expr="pyFeedback.doTotal('text1','text2')">" name="total:int:ignore_empty">


Ever consider using ZPT? Things are much easier to read/maintain in it.

Here's the same thing in ZPT:
Code:
<input type="text" tal:attributes="value python:here.pyFeedback.doTotal('text1','text2')" name="total:int:ignore_empty">


No "tags in attributes" that way!
__________________
Lucas Marshall

Reply With Quote
  #3  
Old September 21st, 2002, 02:37 AM
mutinda mutinda is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: kenya
Posts: 0 mutinda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up Thanks! Now to email....

Thank you for your help Lucas. I was really stressed about that one.

Now I have another problem. I am trying to email the text on a web page. The email gets to its destination but the contents are just gibberish! Is there a way that it can be received in another format apart from .dat? How about .doc or just the page as it is (html)?
I'd really appreciate your help.


Mutinda.

Reply With Quote
  #4  
Old September 21st, 2002, 03:10 AM
mutinda mutinda is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: kenya
Posts: 0 mutinda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy oh no! more function trouble!

I spoke too soon!

I have just tried to call the corrected function but it still has a problem. Is there a simpler way to display the total of several textboxes(with integer values) on a form in one textbox on the same form?

Is it possible for the "total" textbox to have a default state where it "totals" & displays the totals as soon as the form is active?

Mutinda.

Reply With Quote
  #5  
Old September 25th, 2002, 05:35 PM
ZeUs's Avatar
ZeUs ZeUs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: St. George, Utah
Posts: 63 ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level)ZeUs User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 36
So, you want to be able to enter a couple of numbers in a couple of text boxes and have the sum of the two display in another text box on the same form? If so, that's not a job for any server side language... it's a job for JavaScript.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > python functions in dtml

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap