On Sun, May 31, 2009 at 2:24 PM, Rick Jensen <[email protected]> wrote:
>
> Summary: I am trying to autofill an input field based on the values of two
> other fields.
>
> Detail: I have two input fields called First_name and Last_name. I have a
> third field called Profile_name. I want to fill in the Profile_name to equal
> the value of the first two fields automatically when you lose focus on each
> of First_name and Last_name field.
>
> The new value of the Profile_name is a suggestion and the user may choose
> to overwrite it. If they go back and update the First_name and Last_name
> fields after the fact, I don't want to update the Profile_name field again.
>
<input type="text" name="First_name" id="firstName" />
<input type="text" name="Last_name" id="lastName" onblur="fillProfile();" />
<input type="text" name="Profile_name" id="profileName" />
<script>
function fillProfile() {
if (document.getElementById('profileName').value == "") {
document.getElementById('profileName').value =
document.getElementById('firstName').value +
document.getElementById('lastName').value;
}
}
</script>
jQuery'd clean that up a bit, but that's basically how it'd be written.
--
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323012
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4