Very new to Corvid!
I have a user form that fills in the data from the users using the following code. The page this form is on is only available when you are logged in.
import wixUsers from 'wix-users';
import wixData from 'wix-data';
$w.onReady(function () {
//TODO: write your page related code here...
// ...
let user = wixUsers.currentUser;
let userId = user.id;
let isLoggedIn = user.loggedIn;
let userRole = user.role;
user.getEmail()
.then((email) => {
let userEmail = email; // "user@something.com"
$w('#input10').value = userEmail;
$w('#input7').value = userEmail;
});
$w.onReady(function () {
wixData.query("Members/PrivateMembersData")
.eq("_id", wixUsers.currentUser.id)
.find()
.then((results) => {
$w('#input12').value = results.items[0].firstName;
$w('#input9').value = results.items[0].firstName;
});
});
$w.onReady(function () {
wixData.query("Members/PrivateMembersData")
.eq("_id", wixUsers.currentUser.id)
.find()
.then((results) => {
$w('#input11').value = results.items[0].lastName;
$w('#input8').value = results.items[0].lastName;
});
});
});
I have hidden the input boxes so the user does not see this. When the press the submit button (using the code below) the input values are in the input boxes.
export function button11_click(event) {
//Add your code for this event here:
$w('#textBox1').collapse();
$w('#button11').collapse();
setTimeout(function () {
$w("#columnStrip9").collapse();
}, 3000);
setTimeout(function () {
$w("#columnStrip8").collapse();
}, 3000);
setTimeout(function () {
$w("#columnStrip6").expand();
}, 3000);
setTimeout(function () {
$w("#columnStrip10").collapse();
}, 3000);
}
All is working fine. But when the user adds new data to the textBox1 and re-submits the values of their firstname, lastname, and email are not copied. I understand this is because it puts these values in when loading the page with the onReady function.
How do I change the code so that the data is placed in the right place when re-submitting the data?
Really cant figure this out!
Some background information.
It is a ‘ask a question’ box below a livestream video playing above it. The questions dont need to be answered right away but should be available later one.
Thanks already! This forum has gotten me as far as writing this code