Hi, I am trying to do up a “Create Event” Form whereby Event Creators can check the following checkboxes to indicate their target audience:
- Year 1 Students
- Year 2 Students
- Year 3 Students
- Year 4 Students
- Master Degree Students
After pressing the Confirm Button (#confirmBtn), the textbox (#targetAudience) will be auto-filled via the following function:
export function confirmBtn_click(event, $w) {
//Add your code for this event here:
$w("#targetAudience").value = "";
if($w("#year1Students").checked)
{
$w("#targetAudience").value = $w("#targetAudience").value + "Year 1 Students, ";
}
if($w("#year2Students").checked)
{
$w("#targetAudience").value = $w("#targetAudience").value + "Year 2 Students, ";
}
if($w("#year3Students").checked)
{
$w("#targetAudience").value = $w("#targetAudience").value + "Year 3 Students, ";
}
if($w("#year4Students").checked)
{
$w("#targetAudience").value = $w("#targetAudience").value + "Year 4 Students, ";
}
if($w("#masterStudents").checked)
{
console.log("master");
$w("#targetAudience").value = $w("#targetAudience").value + "Master Degree Students";
}
$w("#targetAudience").expand();
console.log($w("#targetAudience").value);
$w("#confirmBtn").hide();
}
So far, I have managed to auto-fill the textbox.
However, when I submit the form, the data in the auto-filled textbox does not appear in the relevant field in my Collection Table.
Also, is it possible to validate dates in Wix Code:
For example, startDate < endDate?