1

I have a bot using bot framework, i am designing it to work on web client.I have an adaptive card from which i ask user to fill in for some details, it works fine but as user clicks submit after filling some details, the values entered by the user on adaptive card vanishes.

In the image shown below i am taking dates as inputs but when user enters the dates and press submit values on the adaptive card disappears

enter image description here

I am not able to retain the values over my adaptive cards, i want values to be visible to the user, i have looked around to solve this issue but i am not able to, right now i am parsing the card from a json file which is present static in my project. Values are not getting vanished i can get the user entered values but i want them to stay over the card.

Nikhil Bansal
  • 163
  • 3
  • 16
  • Does my answer adequately address your issue? If so, please "accept" and upvote it so others can quickly find the answer and I can clear this from my support tracker. If not, let me know how else I can help! – mdrichardson Dec 09 '19 at 16:39
  • No i am still struggling to implement this actually i am blocking submit button click for previous card launched so that if user submits anything my bot does not responds to it – Nikhil Bansal Dec 12 '19 at 03:47
  • Gotcha. That's a little difficult to do. Basically, you need to give the card an ID and add that ID to the `data` attribute of the submit action. Use a validator that only accept if it matches. Or, you can use my AdaptiveCardPrompt that should be in the SDK in the next release in another month or so. [Here's where it does the ID check](https://github.com/microsoft/botbuilder-dotnet/pull/3003/files#diff-c0da9a83b7eddc1eacb13257059740c5R184) – mdrichardson Dec 12 '19 at 16:05

1 Answers1

1

Unfortunately, this is expected behavior. In your case, it looks like you're using Web Chat. The only way to accomplish what you're looking for is either:

1. Build your own version of the AdaptiveCards package, which WebChat uses, then use that in your own build of WebChat.

I don't really recommend this and I'm unsure where the code would need to be changed.

2. Make a hacky workaround that updates the card

It would go something like this:

  1. User submits card
  2. Bot edits card JSON to include user's input into the input fields of the card
  3. Bot replaces the old card with the one that contains the user's input. Here's an example for updating a card in Teams (it can apply to other channels)
mdrichardson
  • 7,141
  • 1
  • 7
  • 21