RelaxoRy <re******@postmaster.co.uk> wrote in message
news:3b**************************@posting.google.c om...
I have 3 texfield boxes
1. firstname
2. lastname
3. username
When a person enters in their firstname and lastname, I want the
username field to fill with firstnameLastinitial.
Eg. Firstname = Adam, Lastname = Apple, Username = AdamA
I want to do it dynamically so as they're typing their firstname, it's
filling in the username field. And when they fill in their lastname,
it does it, but it would only have to do it for the first letter then
go out of the loop.
I don't even know where to start on this one.. onChange is the event?
:)
Any help appreciated
Ryan
Hi Ryan,
sure sounds like this one has been done before somewhere.
The onchange version works when you're finsihed with a field and
could be as simple as
<form name="myform">
<table cols="1" width="200">
<tr><td>
First <input type="text" width="20" maxlength="20" value="" name="first"
onchange="myform.full.value=myform.first.value+' '+myform.last.value;"
/>
</td></tr>
<tr><td>
Last <input type="text" width="20" maxlength="20" value="" name="last"
onchange="myform.full.value=myform.first.value+' '+myform.last.value;"
/>
</td></tr>
<tr><td>
Full <input type="text" width="4" maxlength="40" value="" name="full"
READONLY />
</td></tr>
</table>
</form>
The more dynamic version may be a bit more involved and
will probably use HTMLElement.onkeypress for starters.
No example at this time.
Chris