Use buttons to send data to input field

I could use some help with getting a button press to send data to input fields.

I have setup Custom States and Workflows that set the initial content of an input field based on the button pressed.

The problem I am having is that it is sending the data to all of the fields and I need it to send the data to one field at a time.

I cannot figure out how to “lock” the initial content to the field so that when the field is no longer focused it will keep that content and allow me to select the next input field.

Here is the steps that I would like to use:

  • Select Start New Log button (clears all inputs fields)
  • Select input 1 (focus input)
  • Choose a button (in a repeating group with value assigned by Option Set)
  • Value of this button sets the input value for the selected input field
  • Select input 2 and continue thru inputs until all fields are complete
  • Select Submit Log button - creates a thing with all values of the input

Here is an example showing the general idea with the problem:
button-test-85434.bubbleapps.io/version-test/

If you use a list of custom states to keep track of the 3 measurements, you don’t have to deal with focus of an input etc. See demo below:
chrome_PeZzwlHufQ

The custom state is stored in the page. Name of my option set is Numbers:

When a button is clicked in the repeating group, all it does is to add current cell’s option set value to the custom state:

Then, the M1, M2, and M3 input is just displaying these custom state’s corresponding value at index:
M1:

M2:
image

Start new just resets the custom state:

Of course, the caveat is this is doing it in order. M1 → M2 → M3.

If you want to check all details, here is the editor:

1 Like

@hergin thank you for the quick reply!

I have two problems with this solution. The first is that if I select the same button for the next measurement then it will not send that value to the input. (For example: M1 input set to 0, then M2 input set to 0)

The other problem is that I need a way to control which input is active, and also need the ability to change the value in case the wrong button was selected by accident.

The demo/example we are working with only has 3 inputs. However, the real application will have about 45 input fields. So, I don’t want the user to have to start all over again if they select an incorrect measurement button.

Yea I didnt have these constraints in mind. I will keep an eye on a better solution if I can :slight_smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.