One input for different fields using condition

I need this, (I have one textbox[input] and two buttons)

If I press the button 1 the input will read and write on field ID1
If I press the button 2 the input will read and write on field ID2

In order to do this you’ll need to write two separate onClick() functions for your buttons and include insert() functions in them in which you will be able to specify a collection field where the information from the input should be inserted.

You can find more information about it in the following references:
https://www.wix.com/corvid/reference/$w.Button.html#onClick
https://www.wix.com/corvid/reference/$w.TextBox.html#value
https://www.wix.com/corvid/reference/wix-data.html#insert

Thanks for your answer, but this just solve one problem (write), and the “read”, how do I do? This is the big problem to me.