Could you maybe have one bit of JS that sets the focus, and then add a param
to the widget that takes the DOM id of the field you want to set the focus
to? Then you could pass different Dom ids for each page/view from your
controller.
I haven't used params for widgets a whole lot, but this seems like the way
to do it to me.
Kevin Horn
On 2/20/07, Leandro Lucarella <[EMAIL PROTECTED]> wrote:
>
>
> Christopher Arndt, el 16 de febrero a las 20:15 me escribiste:
> >
> > Leandro Lucarella schrieb:
> > > I tried to add a JSSource("MochiKit.DOM.focusOnLoad('form_usuario');")
> to
> > > the form but I get this error:
> > > AttributeError: 'JSSource' object has no attribute 'label'
> >
> > How do you add it to the form? You have to append it to the 'javascript'
> > attribute of the form object:
> >
> > form = TableForm(fields=[...])
> > form.javascript.append(JSSource('...'))
>
> Mmm, I'm using this but I have a problem, 'javascript' is a class
> attribute, not an instance one, so every form in which I do
> form.javascript.append() it's then rendered in the page, so I have
> multiple JSSource setting focus to different form elements.
>
> form.javascript = [JSSource(...)] is not an option either because the
> TableForm class end up with just the last processed form javascript.
>
> Is there any other way to overcome this issue than subclassing TableForm
> for each form I have to add some javascript?
>
> --
> Leandro Lucarella (luca) | Blog colectivo:
> http://www.mazziblog.com.ar/blog/
> .------------------------------------------------------------------------,
> \ GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05 /
> '--------------------------------------------------------------------'
> Borrowing money from a friend is like having sex. It just completely
> changes
> the relationship.
> -- George Constanza
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---