I am using Adaptive Card SDK in Microsoft Bot Framework for Webchat. Code for my adaptive card submit button looks like :
var action_nothanks = new AdaptiveSubmitAction
{
Title = "No, Thanks",
Type = "Action.Submit",
DataJson = "{ \"action\":\"" + "No,Thanks" + ":" + "false" + "\"}"
};
This doesn't display the user selected value until I use "Data" property instead of "DataJson". But, I want to use as following:
var action_nothanks = new AdaptiveSubmitAction
{
Title = "No, Thanks",
Type = "Action.Submit",
Data = "No, Thanks",
DataJson = "{ \"action\":\"" + "No,Thanks" + ":" + "false" + "\"}"
};
So that user selected value is displayed as "No, Thanks" while bot is returned "false".
One of the possible solution is by adding the
displayTextandactionproperties from theDataobject. Below is the modified AdaptiveSubmitAction code :With a sample bot code, I was able to get both the properties from the data object.
So, when you receive the submitted action, The user-selected value will be displayed as "No, Thanks", while the bot will receive the "false" value.
Bot is created with Echo Bot Sample and modified with required
AdaptiveCardscode snippet.