Hi,
I have this query.
I create a dataset On a specific page and added fields connected to that db.
It works except that it only shows the data of the first row of my collection.
How do I code it to only show the data associated with the current logged in user?
Thank you
Pierre Lacasse
ibmretraitesqc
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixData from 'wix-data';
export function button6_click_1(event) {
const subject = `CHANGEMENT DE COURRIEL profile exIBMistes du Québec`;
const body = `Nom: ${$w("#input5").value}
\rPrénom: ${$w("#input6").value}
\rCourriel: ${$w("#input3").value}
\rNouveauCourriel: ${$w("#input4").value}`;
sendEmail(subject, body)
.then(response => console.log(response))
}
import { sendEmail } from 'backend/email';(response => console.log(response))
J. D. the fieldkey was my problem. it now work perfectly. Thank you for all the help. It is really appreciated.
Pierre
I get this error in the console
Unhandled promise rejection TypeError: Unable to get property 'fieldkey' of undefined or null reference
Hi,
why this isn't working?
I get the proper email address in input3 but input 5 and input6 are blank.
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixData from 'wix-data';
$w.onReady(function () {
let user = wixUsers.currentUser;
let userId = user.id; // "r5cme-6fem-485j-djre-4844c49"
let isLoggedIn = user.loggedIn; // true
let userRole = user.role; // "Member"
user.getEmail()
.then( (email) => {
let userEmail = email; // "user@something.com"
$w("#input3").value = userEmail;
wixData.query("ListeMembres")
.eq("adresseCourriel", $w("#input3").value)
.find()
.then( (results) => {
console.log(results.items);
$w('#input5').value = results.items[0].fieldkey("nomFamille")
$w('#input6').value = results.items[0].fieldkey("prenom")
} );
} );
$w("#button6").enable();
$w("#text52").hide();
})