Options

Onload function

edited November 2007 in Vanilla 1.0 Help
At the signin page it says <body onload="Focus('txtUsername');"> how can i remove that function?

Comments

  • edited October 2007
    Create an extension to empty $Context->BodyAttributes,
    using the 'PreNoPostBackRender' delagation of the SignInForm Control:

    <?php /* Extension Name: MyExtension Extension Url: n/a Description: Remove Sign-in body attributes. Version: 0.1.0 Author: Me Author Url: n/a */ function MyExtension_RemoveOnloadFnc(&$SignInForm){ $SignInForm->Context->BodyAttributes = ''; /** * or * $SignInForm->Context->BodyAttributes = str_replace( * " onload=\"Focus('txtUsername');\"", * '', * $SignInForm->Context->BodyAttributes); */ } $Context->AddToDelegate('SignInForm', 'PreNoPostBackRender', 'MyExtension_RemoveOnloadFnc');
    Put that in /extensions/MyExtension/default.php and enable the extension on the extension setting page.
  • thank you <3
  • edited October 2007
    okay, i don't get it working ~.~ i tried both ways..
  • edited October 2007
    It should look like:function MyExtension_RemoveOnloadFnc(&$SignInForm){ if ($SignInForm->IsPostBack) { $SignInForm->Context->BodyAttributes = ''; /** * or * $SignInForm->Context->BodyAttributes = str_replace( * " onload=\"Focus('txtUsername');\"", * '', * $SignInForm->Context->BodyAttributes); */ } } $Context->AddToDelegate('SignInForm', 'Constructor', 'MyExtension_RemoveOnloadFnc');

    But you will have to had $this->CallDelegate('Constructor'); line 85 of /library/People/People.Control.SignInForm.php so that it look like : function SignInForm(&$Context, $FormName) { ... } $this->Context->BodyAttributes = " onload=\"Focus('txtUsername');\""; } $this->CallDelegate('Constructor'); }

    The delegation will be added to the core. You have to to change /library/People/People.Control.SignInForm.php after the next release.
  • edited October 2007
    You can download this file if you don't want to edit it: http://lussumo.com/svn/people/trunk/People.Control.SignInForm.php
  • thanks a lot for your help :)
This discussion has been closed.