store userinput using buttons

In my userinput sheet, I would like to know how to log the userinput using buttons. I have two buttons labeled Yes and No. When user clicks one of the buttons, I would like it be stored in my sandbox database.
Can anybody help me how to accomplish that.

Currently, I have two radio buttons and a submit button. User selects one of the radio buttons and hits submit button. the way I wanted to do is to have two submit buttons with labels yes and no. As the user hits one of the buttons, it should be able to submit the label value to the database.

Please let me know if my question is not clear!

As can be seen in the image. I want to use buttons instead of radio buttons. I would like to be able to store the button label value to my database. I have three columns already created in my database: name, gender, age.
For each question when I click the button (selected button color changed with onclick event), the button label name is stored in the corresponding column of my database when I click submit button.
Any help is truly appreciated. I cant find a solution anywhere.

Naggi, here’s some code to give you an idea of how it can be done. It does the following things:

  1. Adds a record to the collection after the page loads.

  2. Creates an object (call it anything you want, of course) to store the data when the page loads.

  3. Each button will assign a value to the appropriate field in the object.

  4. The submit button will save the object to the collection. It’s important not to configure the submit button as a submit button and link it to the collection. The code below will do that work.

Hi Anthony,

Truly truly appreciate your message! I am going to try with your code to see if it works for my case.

The image I posted is actually the last page of my 4 page wix slide element. I have a question in each slide page where user inputs using radiobuttons. And the last page is the one where user info is taken.
With the method you proposed, I am assuming that I have to create the onclick event functions for all the pages, correct?
Instead I was thinking if it is possible to create local memory for the gender and age and submit all the userinputs at one time using the regular setup button configuration. My setup button configuration is already storing user inputs from the first three slides as expected.

Naggi, if the first three pages are already storing the data successfully, there is no need to uproot that. All the data from the four pages gets stored to the same record, right?

Yes, I want all the user inputs stored in one line of the database as soon as they hit submit button. You know, once the submit button is clicked the form is allowed for the new set of inputs.