In UWP, specifying the data property on Action.Submit as a string does not work...
{
"type": "Action.Submit",
"title": "Comment",
"data": "action=commentPhoto&photoId=92187"
}
Object works fine though...
{
"type": "Action.Submit",
"title": "Dismiss",
"data": {
"action": "dismiss",
"alarmId": 3
}
}
When we receive the callback and inspect the Data property on AdaptiveSubmitAction, it's null or empty.
We SHOULD be able to do the following as to support both strings and objects being specified there...
if (submitAction.DataJson.ValueType == JsonValueType.String)
{
arguments = submitAction.DataJson.GetString();
}
else
{
arguments = submitAction.DataJson.Stringify();
}
{
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Time to wake up!"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Snooze",
"data": "action=snooze&alarmId=3"
},
{
"type": "Action.Submit",
"title": "Dismiss",
"data": "action=dismiss&alarmId=3"
}
]
}
This used to work correctly when DataJson was simply a string (it was correctly returning a string in this case and a JSON string when it was an object). Maybe the fix is that the DataJson property needs to be a IJsonValue rather than a JsonObject?
The schema states that this can be either a String or JSON object.
Schema documentations specifies that Action.Submit data is either a String or Json object so it's definitely something that needs fixing.
From Ricardo...
The likely changes that need to be made to make this work should be something like:
This fix was pushed in the PR below, I think the bug was not linked then https://github.com/Microsoft/AdaptiveCards/pull/1092