View Full Version : change field

09-26-2008, 09:28 PM
I have this javascript set up and it is working but I was asked to make it to where the username can be edited and then it changes in the display name. not sure why it is not working. the display name is only changing if the first or last are changed.

function BuildUsername() {
var firstname = document.getElementsByName('firstname')[0];
var lastname = document.getElementsByName('lastname')[0];
var username = document.getElementsByName('username')[0];
var domain = document.getElementsByName('domain')[0];
var displayname = document.getElementsByName('displayname')[0];

username.value = firstname.value.toLowerCase().substring(0,1) + lastname.value.toLowerCase();
displayname.value = firstname.value + ' ' + lastname.value + ' (' + username.value + '@' + domain.value + ')';

this is being done with extjs so posting the form will not help I am pretty sure. but I can post it if needed

thanks guys

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum