How to conditionally show/hide form inputs?

I am using a form with many input fields (1; 2;3;4 & so on)
I can make fields 2, 3 & 4 remain invisible and become visible when the previous one is no longer empty.
But on entering row 2 I cannot make row 1 disappear.
When I try then the above solution in reverse, (with regard to making items visible) then it too stops working.

It’s not really clear what are you trying to do and what your conditions should be.
Please explain your idea and what needs to be achieved, also what the show/hide conditions you want to check need to be.

Also, how is your question related to this tutorial, explaining how to toggle an element visibility on click?

I haven’t a clue how to start a question.

Form with Fields A; B; C & D

On making the form visible I want to see INPUT-FIELD A ( this I can do)
On filling the INPUT-FIELD A I want INPUT-FIELD B to become visible (This I can do)
On filling INPUT_FIELD B I want INPUT A to disappear (This I cannot do)
In other words, at any one time, there is only one one input field visible.
I can make them appear but cannot make them disappear.

I hope that is clearer

There is a huge New Topic button in our community, which creates a new topic, where you can ask your questions:

As for the inputs, you can just use dmx-show attribute.

So your conditions, if i follow your logic right, should be:

Input A -> dmx-show="!inputB.value"
Input B -> dmx-show="inputA.value && !inputC.value"
Input C -> dmx-show="inputB.value && !inputD.value"
Input D -> dmx-show="inputC.value"

@beden
Please use this topic to reply, if you have any questions!

Do all the fields have to be visible on pressing the submit button?

Cancel