Hello!
Beginner with code here, so I apologize if this is a stupid question. I’ve been working on a Member’s only form and I need a certain field (that will be hidden) to pre-populate with custom field data collected during registration. The problem is that I can never get it to pull the info. I tried with other info from the database (loginEmail, firstName, lastName, etc) and they all work – except for my custom fields. I know I’m probably writing it all wrong but I tried different iterations of this based on what I’ve seen others do online but nothing seems to work.
First thing I tried:
import {currentMember} from ‘wix-members-frontend’;
$w.onReady(function (){
prepopulateForm();
});
async function prepopulateForm() {
const member = await currentMember.getMember();
console.log(“member”, member);
if (!member) return;
$w("#Pharmacy").value = member.custom.pharmacy-name;
}
Last thing I tried:
import {currentMember} from ‘wix-members-frontend’;
$w.onReady(function (){
prepopulateForm();
});
async function prepopulateForm() {
const member = await currentMember.getMember();
console.log(“member”, member);
if (!member) return;
$w("#Pharmacy").value = member.contactDetails.customFields.custom.pharmacy-name;
}
Any help is appreciated. Thanks in advance!