Hello all, I'm well on my way to having my first working TG app.  TG
is incredibly easy to pick up!!  Thanks to everyone on the list who's
helped me out so far.

I think my last question before declaring victory has more to do with
javascript than TG, but it does involve some TG widget magic so here
goes.  I know this must be easy, if you already know how to do it ;-)

I'd like to have some client-side code update a TG Label widget
whenever a TG textfield widget changes its contents.  (Specifically, I
have two textfields which contain numbers, and I want the label next
to them to always show the correct sum of the numbers in the two
fields. So, seems like I need some client-side async javascript magic)

Reading the TG 1.0 docs (Dynamic Widget stuff) helps but I'm a bit
stumped, as I'm not really a javascript developer yet. I'm fiddling
with js onchange and onblur events, but I'm just stabbing in the dark
at how to retrieve the contents of a widget and do anything with it
once I'm in the called function.  Note I'd like all this to happen on
the client without going thru the TG server, for performance reasons.

Does anyone have a code snippet somewhere that will asynchronously
update a TG label widget based on the content of textfields on a
form?  If I can just see how it's supposed to be done, I'm sure I
won't have trouble getting it into my little app.

in pseudocode I think what I want is:
   num1 = widget.textfield1 contents
   num2 = widget.textfield2 contents
   sum = num1 + num2
   widget.label.updateText(str(sum))

Thanks to anyone who can shed light, I very much appreciate the help!

Cheers,
Billy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to