How to modify input text using "Set state" after user types data in input text

Hi,

I have 3 input text fields namely “Mtr”, “Inches”, “Feet”. I want user to enter one of the input field and then press a “calculate” button against each text field

When I give input in “Mtr” and press “Calculate” the values of “Inches” and “Feet” should be set to zero value and they are working fine.

Once I manually typed a number in the Input text I am unable to reset its value to zero using Set State. Any reason why the setstate in the input text doesnt work once I manually typed some value in it?

You should reset the group that contains the inputs after setting state, I think that would work

This is the setup that I use for dynamic setting of inputs.

  1. Input elements, inside respective Groups

  2. One custom state per Input element

  3. Initial content of each Input element set its own custom state value

  4. On Input value is change, reset other Input elements’ Groups and set their custom states

Hi even I used the similar way. Problem is once I put the cursor on the input text and type something , the set state value doesnt work from then.

If you

  1. press Enter with the new value
  2. execute Reset Group Input A action
  3. set custom state of Input A element
  4. ensure the Initial value of Input A element is set to its own custom state

it works.

You might have skipped some step

Hi @ademiguel this solves half my problem. The other problem is once I put cursor on the input text and enter some value, post this I am unable to change the content/text in the input text using the set state

The Input value won’t change based on a custom state unless you reset it before and link the Initial value to the custom state.

I’m not fully getting what you mean by this. Could you send a video explanation of the problem?

Hi @ademiguel below is the scenario:

  • I have an input text and using set state I am assigning an integer (example: assigned number 0) to it and it works perfect
  • Now I have number 0 in the input text and using a button I am changing the state to number 1 and it works perfect (purpose of button click is to assign the number 1 to the input text)
  • Now I place the cursor on the input text and randomly type a number say “123” and the input text shows “123”. Now I click a button whose purpose is to assign the value of number 1 to input text doesnt work

Hope you understood the scenario. If not I will make a video

Understood and reproduced.

But once again

You can’t expect the value to change if you ONLY set the custom state with Set state action.

You NEED to reset the input by using a Reset Group action AND then set the custom state with a Set state action.

This WON’T work

This WILL work