Generalized Problem Scenario:
I’m trying to add two types of payments (not actual modes but just capturing these modes as text in the DB) - Cash and Digital (Wallet).
In the UI I’ve added the choice component to switch between the modes and dedicated fields get visible for each Mode of Payment (for Cash - Amount field only, for Digital - Amount, Wallet Name, Reference Number fields).
When in the Choice component Cash is selected and I enter a value in the Amount field (e.g. 100), then switch to Digital and enter a value in Amount field (e.g. 200) and submit the form.
When the form is submitted, both the amount values are getting sent to the database.
My expectation is, as a user when I’m submitting the form the amount value for the selected Mode of Payment only should be sent to DB and another value should not be sent to the database.
I’ve been facing this issue for a long time and couldn’t find a workaround for this. I hope someone can help me with this.