In this form, the current user clicks their name (from the 1425MembersAccount) to sign up for a club. Their name is then inserted as a selection tag into the studentsName field in the dynamicDataset (clubDetails).
This is working, however I only get the field tags not the value of the text and I get this message " The value does not match the field type Tags"
Can anyone see my mistake?
Thanks
Sylvia
CODE
//test24
import wixData from 'wix-data';
$w.onReady(() => {
//Extra Member details
$w("#1425MembersAccount").onReady(() => {
let memberDataset = $w("#1425MembersAccount");
let newStudent1 = memberDataset.getCurrentItem().nameOne;
let newStudent2 = memberDataset.getCurrentItem().nameTwo;
$w("#tag1").value = newStudent1;
$w("#tag2").value = newStudent2;
$w("#memberName1Text").value = newStudent1;
$w("#memberName2Text").value = newStudent2;
//clubDetails
$w("#dynamicDataset").onReady(() => {
let clubDataset = $w("#dynamicDataset");
const currentStudents = clubDataset.getCurrentItem().studentNames;
});
});
});
function setTags() {
const allTagsArray = [];
const currentStudents = $w("#dynamicDataset").getCurrentItem().studentNames;
allTagsArray.push('currentStudents');
if ($w("#tag1").checked) allTagsArray.push('tag1');
if ($w("#tag2").checked) allTagsArray.push('tag2');
const allTagsString = allTagsArray.join(",");
$w("#dynamicDataset").setFieldValues({ "studentNames": allTagsString });
}
export function tag1_click() {
setTags();
}
export function tag2_click() {
setTags();
}
export function submitButton_click(event, $w) {
$w("#dynamicDataset").save();
$w("#success").show();
$w("#failed").hide();
}