Dynamic Dataset field input

Hi Sir/Madam,

I am using wix. I get stuck in coding as i have little knowledge of coding.I have created database collection with several fields. I have added a button. I want to add on click event on that button to save the text to dataset without using any text field. I want that when user click on the button then in onclick event i can add a text without getting from any input field.
I have attached the image what i want to to.
Looking for kind and urgent help.

Best Regards
Azmat

Hello.

Assuming that your code is running on a dynamic page and you want to update the values of a field in the current item your code should be as shown below:

$w("#button2").onClick((event) => {
	$w("#dataset1").onReady(() => {
		$w("#dataset1").setFieldValues({
			"age": "65 or above"
		});

	});
});

Keep in mind that this code should run inside your page’s onReady function.
Refer to our API here.

Alternatively, you can use insert function to achieve the same.

Good luck!