Fork me on GitHub

User Login Modification, onClick=...  Bottom

  • Hey,
    I'm trying to edit the [user-login] AutoTheme command to suit my needs. So far, I've changed it so that the default value is Username and Password. In addition, I want it so that when I click on the form, the field automatically clears (instead of me having to erase Username and Password). If I'm being unclear, the same type of setup can be found at www.gamers.nu , just click on the Login field, and it will erase. I've done a bit of research, and found that I need to add javascript to the tag,

    Code

    onClick="this.value=""" onFocus="this.value="""

    However, when I add that code to the tag, it doesnt seem to work. Perhaps I'm adding it in the wrong place, but it seems like it wont pick up the javascript. Heres my userlogin code from atCommands.php that I've modified to my liking (without the onclick... onfocus... tags).

    Code

    $platformcmd['anonymous'] = array (
    'user-login' => 'echo "<form action=\"user.php\" method=\"post\">\n'
      .'  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'

      .'  <input type=\"text\" value=\"Username\" name=\"uname\" onClick=\"this.value=\"\"\" onFocus=\"this.value=\"\"\" size=\"14\" maxlength=\"25\">\n'
      .'  <input type=\"password\" value=\"Password\" name=\"pass\" onClick=\"this.value=\"\"\" onFocus=\"this.value=\"\"\" size=\"14\" maxlength=\"20\">\n'
      .'  <input type=\"checkbox\" value=\"1\" name=\"rememberme\">\n'
      .'  <span class=\"pn-normal\">"._AT_REMEMBERME."</span>\n'
      .'  <input type=\"hidden\" name=\"module\" value=\"NS-User\">\n'
      .'  <input type=\"hidden\" name=\"op\" value=\"login\">\n'
      .'  <input type=\"hidden\" name=\"url\" value=\"index.php\">\n";'
      .'$btn = "<input class=\"pn-button\" type=\"submit\" value=\""._LOGIN."\">";'
      .'echo "$btn;<a href=\"user.php?op=register&amp;module=NS-NewUser\">"._AT_NEWACCOUNT."</a>&nbsp;&nbsp;</form>";',
    );


    Could anyone help me figure out what the problem is here?

    Thanks,
    -NiV
  • BTW, heres a tutorial I found, if it helps. http://htmlgoodies.earthweb.com/tabindexp2.html
  • BUMP hoping that someone will take notice of this post.
  • Not sure how much help it will be but this is the code I use in my AutoThemes when I want a login box.

    Code

    <form action="user.php" method="post">
    User:<input type="text" name="uname" size="11" maxlength="25">
    Pass:<input type="password" name="pass" size="11" maxlength="20">
    <input type="hidden" name="module" value="NS-User" />
    <input type="hidden" name="op" value="login" />
    <input type="hidden" name="url" value="index.php" />
    <input type="submit" value="Login" /></form>


    --
    Zikula Themes
  • hi there,

    it is becaue of the quotes - you need to use two types:

    onClick='this.value=""' onFocus='this.value=""'

    or for PHP :

    onClick='this.value=\"\"' onFocus='this.value=\"\"'

    notice I don't escape this little quote thingy (what the hell are they called anyway?)

    Regards

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Thanks, I'll try that out. I think I may have played around with the quotes a bit, but I probably missed one somewhere.
  • 0 users

This list is based on users active over the last 60 minutes.