Hi Guys
Thanks for looking! We’ve built something pretty cool, at least we seem to think so. What this is is a dynamic checkbox section on a registration page that increases as the related database items increase. It then also submits the checked items to a WiX database and relates these items to the specific profile owner.
I’ve posted the code below, if you’d like to see how it works in action check out the video here:
https://www.wixideas.com/WiX-Ideas/tiaan46/Dynamic-checkboxes
Check/Uncheck code:
export function checkbox_click(event, $w) {
if ($w("#checkmark").hidden) {
$w("#checkmark").show();
} else {
$w("#checkmark").hide();
}
}
export function textCourseName_click(event, $w) {
if ($w("#checkmark").hidden) {
$w("#checkmark").show();
} else {
$w("#checkmark").hide();
}
}
Repeater’s database submission code:
function createTutorCourses(){
$w("#repeater1").forEachItem(($w, itemData, index) => {
if (!$w("#checkmark").hidden) {
const course = $w("#textCourseName").text
let toInsert = {
"title": course,
"course": $w("#textID").text,
"tutor": $w("#input3").value
};
wixData.insert("Tutor_Courses", toInsert)
}else{
wixLocation.to(`/thank-you`);
}
})
}
Thanks for looking!
Tiaan