Ranjan schrieb:
> Hi All,
> 
> I am trying to set focus to the first field of a Widget Form as below
> (refering to the discussion at
> http://groups.google.com/group/turbogears/browse_thread/thread/fc41895d7498c1c5#29b0a6fd33a87484).
> But I am unable to know how to call addLoadEvent(). Needing help.
> 
> class MyForm(TableForm):
>     javascript = [JSSource("""addLoadEvent(function(){
>  
> document.forms[0].elements[0].focus();});""")]
>     fields = [TextField('field1', label='Field1',
>                         help_text=_('(30 chars max)'),
>  
> validator=validators.UnicodeString(not_empty=True, max=30,
> strip=True),
>                         attrs={'size':67}),
>               CheckBox('field2', label='Field2',
>                        validator=validators.Bool(),
>                        help_text=_('(Do you want to expose this task
> to all executor?)')),
>               SubmitButton(name='save', label='Save')]
> 
> Thank,
> Ranjan

function onLoadFunction() {
        document.forms[0].elements[0].focus();
}

MochiKit.Async.signal(window, "onload", onLoadFunction)


Diez

--~--~---------~--~----~------------~-------~--~----~
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