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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What am I doing wrong here?

    When I get to the point where this code should execute, I get an "Object expected" error message. Here's the code.

    Code:
    function generateUsername(){
    	if(document.register.loginUsername.value==""){
    		document.register.loginUsername.value =						
    			substring(document.register.firstName.value, 0, 1) +
    			substring(document.register.lastName.value, 0, 5) + 
    			substring(document.register.birthDate.value, -2, 2);
    	}
    }
    Last edited by bbotts; 07-03-2004 at 06:47 PM.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    I think it should be something like this

    function generateUsername(){
    if(document.register.loginUsername.value==""){
    document.register.loginUsername.value =
    document.register.firstName.value.substring(0, 1) +
    document.register.lastName.value.substring(0, 5) +
    document.register.birthDate.value.substring(-2, 2);
    }
    }

  • #3
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That works. I was thinking in PHP when I was writing it.
    I feel silly now.

    Thanks a lot.


  •  

    Posting Permissions

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