I am trying to create a code that reads the first input field of a WIX form “email” Once it has been filled in, I want the code to autofill several fields based on the contact information that has been saved from a previous form.
I am using the Desktop version of Editor.
This is the code that I have so far. I do know the first 2 lines are not correct - but all the examples I am looking at use those. Not sure where to go from here.
import { Permissions, webMethod } from 'wix-web-module';
import { contacts } from 'wix-crm-backend';
$w.onReady(() => {
$w("#emailInput").onInput((event) => {
const contactEmail = $w("#emailInput").value;
return contacts.getContact(contactEmail);
fillContactForm();
})
})
async function fillContactForm() {
$w("#firstName").value = contacts.contactDetails.firstName;
$w("#lastName").value = contacts.contactDetails.lastName;
//these are guesses. How do I find out the names of each field for the contacts?
}
A similar tutorial that I am trying to modify from Member to Contacts