Hi Doron,
Thanks for helping out. The code below is what I have now, after the corrections you pointed out. The setFieldValue, as I understand it from the link you refer to, needs to FieldName, not the FieldKey, therefore I changed it to match what I have in the collection.
import wixData from 'wix-data';
var selections = [];
for (var i = 0; i < selections.length; i++) {
selections[i] = '';
}
$w.onReady(function () {
//TODO: write your page related code here...
});
function update_checkbox(checkboxID, string, ID) {
if ($w(checkboxID).checked) {
selections[ID] = string;
console.log(selections);
} else {
selections[ID] = '';
console.log(selections);
}
}
export function submitstrategies_click(event, $w) {
$w("#strategiespanel").expand();
$w("#strategiespanel").show("FadeIn");
}
export function closestrategies_click(event, $w) {
$w("#strategiespanel").collapse();
$w("#strategiespanel").hide("FadeOut");
}
export function closetools_click(event, $w) {
$w("#toolspanel").collapse();
$w("#toolspanel").hide("FadeOut");
}
export function submittools_click(event, $w) {
$w("#toolspanel").expand();
$w("#toolspanel").show("FadeIn");
}
export function checkbox1_change(event, $w) {
update_checkbox('#checkbox1', 'Autocad', 1);
}
//many functions, one for each checkbox...
//...
export function checkbox45_change(event, $w) {
update_checkbox('#checkbox45', 'geothermal heating', 45);
}
export function button6_click(event, $w) {
$w("#ifc_data").onReady(() => {
var tools = '';
var strategies = '';
for (var t = 0; t < 14; t++) {
tools += selections[t];
}
for (var s = 15; s < 44; s++) {
strategies += selections[s];
}
$w("#ifc_data").setFieldValue('digital tools', tools);
$w("#ifc_data").setFieldValue('strategies', strategies);
});
}
The errors are:
TypeError: $w(…).onReady is not a functionsubmit - Line 191
//this is the line in the button6_click function
save operation failed: DatasetError: Some of the elements validation failed
//I assume this has something to do with the $w(“#ifc_data”).onReady(() => {…
Can you assist me with this further?
Thank you