Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Combine First_Name and Last_Name into Name - Javascript

Combine First_Name and Last_Name into Name - Javascript

Combine First_Name and Last_Name into Name - Javascript

Hi all.

New to Javascript. I have a variation of the following script working just fine for calculating a number from two other numbers input into a PHP form but I'm wanting to do the same thing to combine to name fields into a Full Name field.

Hoping someone can help me! Or maybe "keyup" function just doesn't work for non-number fields?


var ctrlFirst_Name = Runner.getControl(pageid, 'First_Name');
var ctrlLast_Name = Runner.getControl(pageid, 'Last_Name');
var ctrlName = Runner.getControl(pageid, 'Name');

function func() {
ctrlName.setValue(ctrlFirst_Name.getValue() +

ctrlFirst_Name.on('keyup', func);
ctrlLast_Name.on('keyup', func);



RE: Combine First_Name and Last_Name into Name - Javascript

Actually your code looks like it is gonna work but still I wrote some basic code joining two names on keydown event. It is very basic code. Hope you will find useful.



<!DOCTYPE html>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <input type="text" id="fname"><br/>
  <input type="text" id="lname"><br/>
  Full Name:
  <input type="text" id="fullname"> 


CODE --> Javascript

function joinName(){
  document.getElementById('fname').value+" "+


If you want to try out here is the link

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close