Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Disappearing Values

    Hello all,

    I've been working with this simple html script. It works great in IE and FF but am having problems in Mac Safari.

    In Safari, the value entered in the First Name field disappears when the user clicks on the next field. However, the value does not disappear when the user clicks, not on the next field, but on the form, itself. With a couple of alerts, I was able to determine that, even though, the user doesn't see the value, it does exist.

    Why is the value disappearing? Any hints or suggestions are greatly appreciated.

    Here are the actions to recreate:

    Actions:
    Enter a value in the First Name field
    Click on the Last Name field

    Result:
    The value disappears

    Actions:
    Enter a value in the First Name field
    Click anywhere on the form, except in the Last Name field

    Result:
    The value doesn't disappear


    Here is the simple html code:
    =========================================================
    <html>
    <head>
    <script language="javascript">

    function leftAlignSelect( element )
    {
    element.style.textAlign='left';
    element.select();
    return true;
    }
    function validateByte( element )
    {
    return true;
    }
    </script>
    </head>

    <body>
    <FORM name=mainForm method=post>

    First name:
    <input type="text" id="fname" name="fname" size=22 maxLength=22 onblur="validateByte( this );this.style.textAlign='right';" onfocus="leftAlignSelect( this );">

    <br />
    Last name:
    <input type="text" name="lname" />

    </form>
    </body>
    </html>

    =========================================================

    Thanks,
    doyenne
    Last edited by doyenne; 11-02-2006 at 08:23 PM. Reason: Wrong title

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't have Safari (or even a Mac) but it may dislike a couple of things in your code.

    Try enclosing values in quotes eg. size="22", and not having spaces in the Javascript brackets, eg.

    onblur="validateByte(this); this.style.textAlign='right';"


  •  

    Posting Permissions

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