that having observers in widgets, would be a plus to turbogears, like in JSF (Java Server Faces).
How the thing works?
You create a widget and associates some event that occurs in this widget with one method in the server, and the application write all _javascript_ necessary to you.
example:
nowadays:
apartmentType = widgets.TextField(
name = "apartamentType",
label = "Name: ",
attrs = dict(maxlength = "64", size = "30" ),
validator = validators.String(max = 64, not_empty = True),
help_text = ""
)
with event handler, the widget could be
apartmentType = widgets.TextField(where
name = "apartamentType",
label = "Name: ",
attrs = dict(maxlength = "64", size = "30" ),
validator = validators.String(max = 64, not_empty = True),
help_text = "",
event_handler = dict('onchange', 'selectedApJs', "turbogears.url('selectedAp')")
)
event
selectedApJs = _javascript_ function to work with data returned by turbogears.url('selectedAp')
selectAp = method in the server, invoked by any change on this textfield.
I think is this.
mario h.c.t.
On 10/17/06, Jorge Godoy <[EMAIL PROTECTED]> wrote:
isaac <[EMAIL PROTECTED]> writes:
> I'm wondering... how would you do that *without* JS?
Probably Rails generates the _javascript_.
> Or do you mean "JS I don't have to write myself"? ;)
Probably. :-)
BUT there's also a different paradigm as a push method instead of a polling
application. Take a look at comet, for example.
> This could be done fairly easily as a widget, it's just that no one
> has done it in a handy re-usable form, AFAIK, yet.
It just takes a couple of lines. It's so simple that isn't worth packaging
alone :-)
I believe that it makes more sense when you embed it with your application's
specific code to achieve something otherwise it is a bit overkill to use
widgets just for that and using them alone at the template.
--
Jorge Godoy <[EMAIL PROTECTED] >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- [TurboGears] Re: Observers mario henrique
- [TurboGears] Re: Observers Adam Jones
- [TurboGears] Re: Observers isaac
Reply via email to

