top of page
Forum Posts
claudio.jimenezc
Mar 14, 2021
In Coding with Velo
Hello friends. Im stuck with this (days), i need to get the average of 3 items (dropdowns) in the same container, my code does not work, can you help me review it? import wixData from 'wix-data';
import wixUsers from 'wix-users';
$w.onReady(function () {
let user = wixUsers.currentUser;
let userId = user.id.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""user@something.com"
console.log(userEmail);
console.log(userId);
$w("#dataset1").setFilter(wixData.filter()
.eq("mail", userEmail)
);
});
});
$w("#repeater1").onItemReady( ($item, itemData, index) => {
let sabe = $item("#dropdown1");
let quiere = $item("#dropdown2");
let puede = $item("#dropdown2");
let avgTotal = sabe + quiere + puede / 3;
$item("#input2").value = sumTotal
}); I would greatly appreciate your help
Thanks!
0
6
61
claudio.jimenezc
Dec 31, 2020
In Coding with Velo
Hello All. I need to create a page that only asks for a code to enter and once the person enters, the code is no longer reusable. The problem with my code, is in my database, when overwriting the information to remove the password used, the new information is written at the beginning of the database and not in the field that matches the password. I want to overwrite the password with the word "DONE", making it not match in a next use. This is my code, if i put the correct password i can enter to the URL (inside the code) and in my database is saving the word "DONE" but at the beginning. The problem, i can enter with the same password. import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(function () {
});
export function button29_click(event) {
let contrasena = $w('#input1').value;
wixData.query('EvaluaciondeClimaLaboral')
.eq('title', contrasena)
.find()
.then(results => {
if (results.items[0].title === $w('#input1').value) {
$w('#EvaluacionD').setFieldValue("title", 'DONE');
$w('#EvaluacionD').save();
wixLocation.to("http://xxxxxxxxxxxxxxxxxxxxxxxx");
}
else if (results.length === 0) {
$w('#text134').show();
}
else {
}
})
}
If you could help me I would appreciate it.
0
6
85
claudio.jimenezc
More actions
bottom of page