> I am trying to set focus to the first field of a Widget Form as below > (refering to the discussion > athttp://groups.google.com/group/turbogears/browse_thread/thread/fc4189...). > 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();});""")]
It works! My silly overlook was that first element in the form was a hidden field. So merely changing elements[0] to elements[1] did the trick. Thanks a lot Ranjan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

