Last name ,first letter autopopulate

User_267
Tera Contributor

I have created a variable - name

And another variable- last name

So whenever the user enters last name(ex-john) then first letter "j" should populate in name field.

Require client script for this.

5 REPLIES 5

Samaksh Wani
Giga Sage
Giga Sage

Hello @User_267 

 

You need to write the onChange Client Script :-

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

var name = g_form.getValue('last_name_field_name');
var array = name.split("");
g_form.setValue("name_field", array[0]);
}

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh

 

 

It's not working 

Hello @User_267 

 

Can you pls share the screenshot the code which you wrote.

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh

Hello @User_267 

 

The below line needs to be modified in above code.

 

var array[] = name.split("");

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh