I’m baaack!! I think putting our heads togheter may help the community for I know I’m not the only one with an issue with an export function, onClick to Submit 2 tables at once.
So here we go:
A form filed with many inputs goes to one dataset called Candidates. All but for one dropdown that should go to another table called Subscriptions.
The reason is that it will be possible for one candidate to populate the field more than once, hence the need for a table that will gather all the applications, from all the candidates.
So I am able to submit to the Candidates table, no problem, and I added a code to the same button hoping that the onclick will populate the Subscription table…
Here’s an attempt, don’t laugh…
let link-candidats-update-Id= Candidats Update ID;
// create an item
const toInsert = {
“_id”: link-candidates-update-Id, //field of the userID in the Candidates table
“email”: userEmail
};
// add the item to the collection
wixData.insert(“Subscription”, toInsert)
. catch ((err) => {
console.log(err);
});
export function button8_onclick() {
let Subscriptions = {
“retenuLrh”: $w(“#dropdown6”).value, //fileds in the Subscriptions database
“CandidatesUpdateID”: $w(“”).value,
“First name”: $w(“#input3”).value,
“Last name”: $w(“#input4”).value,
};
console.log("Subscriptions" + JSON.stringify());
wixData.insert("Subscriptions")
}
Any idea?
Thanks