Thanks, I have the id already from my template, so this should work.


On Sep 22, 1:10 pm, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
> Billy Charlton schrieb:
>
> > in pseudocode I think what I want is:
> >    num1 = widget.textfield1 contents
> >    num2 = widget.textfield2 contents
> >    sum = num1 + num2
> >    widget.label.updateText(str(sum))
>
> Define an onclick or onchange function on the textfields, e.g.
> setting attrs=dict(onclick="change_label(this)"), and
>
> function change_label(e) {
>      var form = e.form;
>      var sum = form['num1'].value + form['num2'].value;
>      var d = ... get label element ...
>      d.data = sum;
>
> }
>
> How you get the label element depends on which kind of form you're using
> and where the label is located. One possibility is to get the
> corresponding form field element and then huddle through the DOM using
> parentNode, firstChild etc. to get its label. Or you can set an id on
> the label in a custom template.
>
> -- Christoph
--~--~---------~--~----~------------~-------~--~----~
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