Custom form - How to submit existing text + user input

Hello all,

I am new to coding. I am creating a custom form where users will be able to select from checkboxes that will represent categories and then fill in the required input. Once they select a checkbox, the rest of the form corresponding to the category name will expand. There will be about 20 checkboxes eventually , all with the same input.

You can see my example below. I have started off by just developing 3 to see how I go with the coding. All is going well so far, but when I submit the form only the input for the number and quantity is recorded. How can the ‘category’ text be attached so when users submit the form it too will come up on my database?

$w.onReady(function () {
    $w("#checkbox1").onClick( (event) => {
 if ($w("#checkbox1").checked===true) {
            $w('#group1').expand()
        }
 else
        {
            $w('#group1').collapse()
        }
 
} );

    $w("#checkbox2").onClick( (event) => {
 if ($w("#checkbox2").checked===true) {
            $w('#group2').expand()
        }
 else
        {
            $w('#group2').collapse()
        }
 
} );

    $w("#checkbox3").onClick( (event) => {
 if ($w("#checkbox3").checked===true) {
            $w('#group3').expand()
        }
 else
        {
            $w('#group3').collapse()
        }
 
} );

} );

Looking forward to your solutions!

https://petegregory95.wixsite.com/website-1

Can you provide the code you are using for inserting to the database…
Thanks!!

Hi!

Thanks for the reply.

I have connected it like this.

I have also just realised that it won’t allow for individual input for each text field.
If I put a “1” in the the number field for food, it comes up on all other fields as well like this

@petegregory95 As you have to type in the input field, you don’t have to connect the input to the dataset…
It is in the picture that the connection is for getting the value from the database and displaying it to the input !!!

I am getting this like →
There are two inputs.
One for ‘number’ other for ‘quantity’.
An user types in the input(s).
So, you want to insert →
The value in the ‘number’ input to the ‘number’ field and the value in the ‘quantity’ input to the ‘quantity’ field and the category to the database…

If this is →
How did you connect the ‘Food’ ‘Fluid’ ‘Element’ and to which dataset ?