How to change the visibility of the component based on users previous input?
1

Use Case: When the flow starts users will see the dropdown with dynamic data. In which there will always be a custom as last index. When users select custom I want to change the visibility of a textbox to true so that they can enter the custom value in the dropdown. How to achieve this with out data_exchange.

I have tried visibility: "${form.my_dropdown == 'custom'}" didn't worked

Sai
Asked about 7 months ago
Selected Answer
3

Hi Sai, That was a great question with a great timing. We've just early released the conditional rendering components If and Switch. Please check the docs https://developers.facebook.com/docs/whatsapp/flows/reference/flowjson/components

In your particular case you could wrap your component within an If, something like this:

{
  "type": "If",
  "condition": "${form.my_dropdown} == 'custom'",
  "then:" [
   // components you want to show in that case
  ]
}

If you want to show other stuff, you can also add the optional attribute else in the code above.

Hope this helps!

June 12 at 4:47 AM
Flávio