Never mind, I just made a constructor instead:

        def js_default_text(default_txt):
            js_clear_default = "if (this.value=='%s') this.value=''" %
default_txt
            js_restore_default = "if (this.value=='') this.value='%s'"
% default_txt
            return dict(
                default=default_txt,
                attrs=dict(
                    onFocus=js_clear_default,
                    onBlur=js_restore_default,
                    ),
                )

            description = TextArea('description',
                label='Work description',
                rows=5, cols=80,
                validator=UnicodeString(not_empty=True, strip=True),
                **js_default_text(request_default_txt)
                )

As long as the pieces of js I attach are fairly simple, it should be
fine for my needs.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
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