View Full Version : Showing letters in form

07-27-2011, 10:12 PM
Hey everyone :)

Okay so...
I'm working on a site, which will include a registration form for users that wish to register. In this registration form I would like it to have an AJAX based effect, such that when the user types each letter out for his username in the field, his username will appear (letter upon letter) itself below, at the end of their unique url.

To explain further:-
Say I type my username to be Owen
Below the field I would like it to display:
As I type it. Is this possible?

I've done my research, but had little luck. I'm sure it is possible as I've seen it before in a slightly different manner.

Hope you can or are willing to help :thumbsup:

Thank you
Owen Ayres

Old Pedant
07-27-2011, 10:32 PM
Very very simple:

<script type="text/javascript">
function updateURLs(nm)
document.getElementById("url1").innerHTML = "http://www.mydomain.com/" + nm;
document.getElementById("url2").innerHTML = "http://" + nm + ".mydomain.com";
Enter your name: <input name="myname" onkeyup="updateURLs(this.value)">
url1: <span id="url1">http://www.mydomain.com/</span>
url2: <span id="url2">http://.mydomain.com</span>

If you wanted the URLs to be in form fields instead, that's a trivial change.

07-27-2011, 10:39 PM
That's the bad boy I want :D
Thanks for the help and speedy response Old Pedant!