Odd Issue

Hello everybody!
I’m a new user of Wix and in the process of building my first web page. So far so good, but I’ve stumbled across an issue I need help with.
I have created a database and linked it with the corresponding user input fields, added a submit button, tested it and it works great. The problem is that I wanted to add buttons with predetermined options for the user input fields. ( User clicks → input field is filled with button information ) I have used the command :

export function hoverBox1_click(event) {
$w(‘#input2’).value=“whatever”

And it does indeed do what it is supposed to do, it changes the input field, but when I click on the “Submit” button in Preview Mode, all that happens is that a new blank row is created in my database and no other information is added to it.

I would be grateful for some fresh suggestions, or even other types of commands or workarounds to my issue.
Thank you in advance !

Greetings,

I’ve encountered the same thing writing autopopulating code with that approach. You see the values of the inputs change, but the data does not save. Instead, I use the dataset.setFieldValues function, and it both updates the inputs and saves to the collection, provided you use a submit button or explicitly call the dataset.save function.

Anthony

Thank you very much Anthony, your solution worked great !