My Main gold is to Create a task / request form using table.
Temporary save registered data in the table to a variable "ItemsRows".
When user has registered all items in the table user can press "Send Request" this will then save all data from variable "ItemsRows" to my MySQL DB using a Insert query.
I have a button that adds empty row to my table / variable ItemsRows with a PrimaryKey, Row number, and due date.
I need some help with updating variable ItemsRows when user register information in the table.
I get output error: Unexpacted token '{'
The script I have that do not work is :
// Function to update Description in ItemsRows based on row index
function updateDescription(rowIdx, newDescription) {
let items = [...ItemsRows.value]; // Create a copy of the ItemsRows array
if (rowIdx >= 0 && rowIdx < items.length) {
// Update the Description field in the specific row
items[rowIdx].Description = newDescription;
ItemsRows.setValue(items); // Update ItemsRows with the modified array
}
}
// Event handler for Description field change
function handleDescriptionChange(rowIdx, newDescription) {
updateDescription(rowIdx, newDescription); // Call updateDescription function
return ItemsRows.value; // Return the updated array (optional, but good practice)
}
// Assuming you have the row index and new description passed as parameters to the query
const rowIdx = {{self.rowIndex}};
const newDescription = {{self.Description}};
handleDescriptionChange(rowIdx, newDescription);
Is there some error in the code?
Note I have no knowledge about Javascript. so I need how to solve this for dummys.
Hope that there are somebody that will take the time to help me.