How can I auto populate email field, when user field filled.

ND7
Kilo Sage

Dear Expert,

How can I proceed with this requirement? Once the user field name is entered, the email field should automatically populate. Please help Thank you so much. Appreciate your help. 

find_real_file.png

2 ACCEPTED SOLUTIONS

did you try putting alerts ?

make sure your back end names of variables are correct  

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
 
    var user = g_form.getReference('name', userDetails);
    
    function userDetails(user) {
alert(user.email);
        g_form.setValue('email', user.email);
    }
}

View solution in original post

Thank you Ankur, I will try this Catalog lookup for sure. BEST

 

View solution in original post

20 REPLIES 20

ND7
Kilo Sage

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
 
    var user = g_form.getreference('name', userDetails);
    
    function userDetails(user) {
        g_form.setValue('email', user.email);
    }
}

Sadly it did not work.  😞

 

find_real_file.png

HELLO ,

replace your script to below

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
 
    var user = g_form.getReference('name', userDetails);
    
    function userDetails(user) {
        g_form.setValue('email', user.email);
    }
}

MARK MY ANSWER CORRECT IF IT HELPS YOU

Sadly it did not auto-populate the email field. 

did you try putting alerts ?

make sure your back end names of variables are correct  

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
 
    var user = g_form.getReference('name', userDetails);
    
    function userDetails(user) {
alert(user.email);
        g_form.setValue('email', user.email);
    }
}

THANK  YOU SO much  Mohith Devatte!!!!! It WORKED... 

Saved my DAY...  and weekend 🙂 

Have a great weekend.. Thankyou again.