I want to see in a database if a customer clicked on an image or not. This is part of a form.
My solution: I created an image and a checkbox.
I wrote some code to change the “checked” property of the checkbox when clicking an image.
Of course you can click it again to uncheck the checkbox.
export function bild1_click(event) {
//Add your code for this event here:
$w('#checkbox11').checked =!$w('#checkbox11').checked;
}
Then I linked the checkbox to a database to see if a customer clicked the image after completing the form.
I changed the field in the database to show a text and not boolean.
In row number one I clicked the checkbox and submitted the form.
In row number two I clicked the image and submitted the form. Note that the checkbox in the preview appears to be checked regardless if I click the box or the image.
I want to be able to click the image and let the field state “true”.
Does anyone see any glearing issues? Why does the field not state “true” if I click the image?

Any help is greatly appreciated!
Hello.
The code you are using is not complete.
To submit information to a database for the first time, you need to use inser() and to change the state you need to use update() .
You can refer to our API here to proper checked mixin systax or the filterByCheckboxes() function in this example.
Good luck!
I’m sorry to bother you again but I think I didn’t explain my problem well enough before. I’m trying to clear things up now.
This is what my page looks like.
This is the code that goes with the page

And here is the dataset that is linked to the custom form (there are later going to be multiple pictures, there is only one now for simplicty)

Customer 1 clicked the checkbox normally and sumbitted.
Customer 2 clicked on the image (checkbox appears to be checked) and submitted.
The database in customer 2 doesn’t show the checkmark. Why is that?
I want the database to show the tickmark even when clicking the picture.
Because later I want to hide the checkbox and let customers select a product via clicking the picture.
I tried to find a solution everywhere and can’t seem to find it.
Thanks for your help.