Automatic fill

I’m sorry, but the article was a bit too complicated for me to understand.

I was doing my best to explain everything you need in details, you can only read Section 4 , you won’t need the previous sections in your case.

Ok, that you. I will do that.

I will try my best to use the code you provided in the article in my code. I will try to send you the code tomorrow(as I have school tomorrow and can’t stay up late tonight.:sleeping::sleeping::sleeping::grinning:

I’ll be glad to help :wink:

Ok! Give me 30min to finish my homework. Please do something else in the meantime​:wink::wink::wink::wink::wink:.

Does this code let you collect data from a database I don’t have access to? Also, what does back-end-code & Front-end-code mean?

Yeah, it lets you bypass the permissions.
Back-end code: A code that runs on the server side.
Front-end code: A code that runs on the visitor’s web browser like Google Chrome (client side).

So I copy the code in the getMemberDetails Web module?

For questions about the permissions please comment them on my tutorial above

ok.

Still got the error message on getDetails

import wixUsers from 'wix-users';
import { getMemberId} from 'backend/getMemberDetails.jsw';
let user = wixUsers.currentUser;

$w.onReady(function () {
 if (user.loggedIn) {getUserDetails() }
})
functin getDetails() {
 return
     getMemberId(wixUsers.currentUser.id).then((result) => {
 let name = result.name;
 let email = result.email;
 
$w.('#input2').value = name;
$w('#input3').value = email;
     })
}

I told you, you’re missing the o letter in the 8th line, in the functi o n word.

oh.

Thanks a lot! The error is now gone!

You’re welcome

Hi. I still got an error message. I think I have copied the code correctly. Also, I got an unreadable code. I know you might be busy, but I really need help to enable auto fill for my form.

import wixUsers from 'wix-users';
import { getMemberId} from 'backend/getMemberDetails.jsw';
let user = wixUsers.currentUser;

$w.onReady(function () {
 if (user.loggedIn) {getUserDetails() }
})
function getDetails() {
 return
     getMemberId(wixUsers.currentUser.id).then((result) => {
 let name = result.name;
 let email = result.email;
 
$w('#input2').value = name;
$w('#input3').value = email;
  })
}

Hi Arthur,

The unreachable code is because you’re not putting the " return " word in the correct position, you need to put it on the same line or the function or the next lines will be ignored, I recommend that you replace it with " await " and change the function to an async function.

async function getDetails() {
        await getMemberId(wixUsers.currentUser.id)
        .then((result) => {
                 let name = result.name;
                 let email = result.email;
 
                $w('#input2').value = name;
                $w('#input3').value = email;
          })
}

Or make sure you’re using the correct syntax.

function getDetails() {
    return getMemberId(wixUsers.currentUser.id)
    .then((result) => {
        let name = result.name;
        let email = result.email;
        $w('#input2').value = name;
        $w('#input3').value = email;
    })
}

Regards.
Ahmad

Hi Ahmad,
I did do that. The only thing is I got an error message. I got it on the 3 rd line of code.

import wixUsers from 'wix-users';
import { getMemberId} from
'backend/getMemberDetails.jsw';
let user = wixUsers.currentUser;
$w.onReady(function () {
 if (user.loggedIn) { getUserDetails()}
})
async function getDetails() {
 await getMemberId(user.id).then((result) => {
let name = result.name;
let email = result.email;
$w('#input2').value = name;
$w('#input3').value = email;
    })
}

Please help me.
regards
Arthur

No, sorry. I got the error message on the 6 line of code.