SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 31 of 31
  1. #26
    Grüße aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,043
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Yeah, this method kills Chrome unfortunately.

    Felgall - any joy getting your method to work?

  2. #27
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,868
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Pullo View Post
    Felgall - any joy getting your method to work?
    It worked when I first wrote it so presumably there's just another typo there somewhere. I had to completely rebuild my computer a couple of weeks ago and so have only just finished reinstalling IE8 and IE9. I'll take a look at it over the weekend and work out what's wrong with it in whichever of those browsers it currently has the problem with.

    I am going to add a working example to that page as well.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #28
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,868
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    There were a couple of other typos in my code. I have now corrected them and the code now works in IE8 and IE9 as well as modern browsers.

    I have also attached a live example of the code to that page which is what I used to test.

    Since the link is now quite a few posts back I'll include it again: http://javascriptexample.net/domform08.php
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #29
    Grüße aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,043
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Hi Stephen,

    At the risk of being a PITA, your example doesn't work for me (in Chrome, FF or IE).
    If you click into the password field, the text is masked, but when you click into one of the dummy fields, then back into the password field, it stays masked (the OP wanted it to be revealed until the user starts typing).

  5. #30
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,868
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Pullo View Post
    Hi Stephen,

    At the risk of being a PITA, your example doesn't work for me (in Chrome, FF or IE).
    If you click into the password field, the text is masked, but when you click into one of the dummy fields, then back into the password field, it stays masked (the OP wanted it to be revealed until the user starts typing).
    That code only has the focus event to mask the field when it gets the focus. It then stays masked. The assumption being that once the visitor gets to that field that they will start typing their password. It is after all just intended as an example of how to change the type.

    If the person is going to be able to go to that field and then leave without typing anything and you want it to change back when they do that then you'd need to add code for a blur event that tests if the field is empty and if so runs the equivalent code in reverse to unmask the field. That is, you'd add the following code:

    Code:
    passBlur = function() {
    if ('password' === this.type && '' === this.value) {
      /*@cc_on
        @if (@_jscript)
          @if (@_jscript_version < 9)
      var inp = document.createElement("<input name='pass'>");
        inp.id = 'pass';
        inp.type = 'text';
        inp.value = 'password';
        this.parentNode.replaceChild(inp,this);
        setTimeout(inp.focus,5);
          @else
      p.type = 'text';
      p.value = 'password';
      @end
      @else */
        this.value = 'password';
        this.type = 'text';
      /* @end @*/
    }
    }
    addEvent(p, 'blur', passBlur);
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #31
    Grüße aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    6,043
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Ah ok, thank you.
    @fazthegreat ; does that work for you?


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •