/    Sign up×
Community /Pin to ProfileBookmark

How to combine FName and LName into FullName

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() +
(ctrlLast_Nme.getValue()));
};

ctrlFirst_Name.on(‘keyup’, func);
ctrlLast_Name.on(‘keyup’, func);


*******************************************

Thanks!
Eric

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumJan 16.2021 — `Runner` - do you use some plugin or library?
Copy linkTweet thisAlerts:
@VITSUSAJan 16.2021 — @ER1CMURPHY#1626830 Code is right but what error message you are getting?
×

Success!

Help @ER1CMURPHY spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 3.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 10 SATS,
)...