autofill textboxes

This is a discussion on "autofill textboxes" within the Web Page Design section. This forum, and the thread "autofill textboxes are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 14th, 2006, 18:53
New Member
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
autofill textboxes

Hi
I was playing with this code and i discovered something pretty weird.

Since emails don't have spaces, I used the replace function to replace " " with "".

BUT....
ie.
First: Anna Smith
Last: Boa Wow
Email: AnnaSmith.Boa Wow <- doesn't replace the " " with ""

now isn't that weird... anyone know why? or how I can fix this?


Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script type="text/javascript"> function setEmail(){ var theemail = document.forms[0].fname.value+'.'+document.forms[0].lname.value; theemail = theemail.replace(" ", ""); document.forms[0].email.value = theemail; } </script> </head> <body> <form action="#" method="post"> <input type="text" name="fname" onKeyUp="setEmail()" size="15"> <input type="text" name="lname" onKeyUp="setEmail()" size="15"> <input type="text" name="email" size="15"> </form> </body> </html>
Reply With Quote

  #2 (permalink)  
Old Feb 14th, 2006, 19:22
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: autofill textboxes

If there email contains spaces ask them to fill it out again, no use trying to make your own by deleting spaces.

Also using javascript for validation is a bad idea because people can just disable javascript in their browser.
Reply With Quote
  #3 (permalink)  
Old Feb 14th, 2006, 19:35
New Member
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: autofill textboxes

Quote:
Originally Posted by sypher
If there email contains spaces ask them to fill it out again, no use trying to make your own by deleting spaces.

Also using javascript for validation is a bad idea because people can just disable javascript in their browser.
doesn't that defeat the purpose of what programming/scripting is all about?
Reply With Quote
  #4 (permalink)  
Old Feb 14th, 2006, 19:42
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: autofill textboxes

Not if your going to be getting bogus code.

You have to make it so they enter the right details no use having the field otherwise.
Reply With Quote
Reply

Tags
autofill, textboxes

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding Textboxes RubyRue ASP.NET Forum 2 Feb 21st, 2008 17:51
Autofill in Flash forms? Shady Flash & Multimedia Forum 1 Feb 8th, 2008 16:01
Using listeners with dynamic textBoxes DrGonzo Flash & Multimedia Forum 0 Aug 8th, 2007 10:24
writing a function to verify data inputted in textboxes jayaime JavaScript Forum 2 Jul 4th, 2006 03:29
Lists, Buttons and Textboxes callamac Web Page Design 4 Apr 6th, 2006 13:39


All times are GMT. The time now is 20:47.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43