botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Question] AdaptiveCard SubmitAction not working.

Open JeevaJose opened this issue 9 years ago • 3 comments

I am working on AdaptiveCard configured with one input box and 3 buttons, when user click on the submit button I want to get the result in the code behind. I am getting the result but I want to know which button clicked to submit the result.

When I click on button 1 I am getting following error:

[err-client] Uncaught TypeError: Cannot create property 'firstName' on string 'one' \botframework\app-3.5.29\resources\app\node_modules\adaptive-cards\built\card-elements.js 1134 51 {}

When I click on button 2 I am getting the input value but there is no information about button.

If I remove TextInput and keep button in that case I am getting submit button value and no error .

Emulator version : 3.5.29 Development platform : .Net

card.Body.Add(new TextInput() {
   Id = "firstName",
   Placeholder = "What is your first name?"
});

card.Actions.Add(new SubmitAction() { Title = "one", Data="one"});
card.Actions.Add(new SubmitAction() {  Title = "Two"});
card.Actions.Add(new SubmitAction() { Title = "Three"}); 

Not able to get submit button value if I have any inputText. Please let me know how to get the button value.

JeevaJose avatar May 28 '17 09:05 JeevaJose

The Data parameter should be a json object:

card.Actions.Add(new SubmitAction() { Title = "Three", Data = Newtonsoft.Json.Linq.JObject.FromObject(new { button = "three"} ) });

Setting the SubmitAction's Data property to a string will attempt to send it in the Text property of the message to the bot. But, since the Body has a TextInput, the SubmitAction's Data should be a json object so they can be combined in a json array in the value:

jobject

EricDahlvang avatar May 29 '17 23:05 EricDahlvang

https://user-images.githubusercontent.com/45025662/55156978-4a424980-5181-11e9-8287- 765169bc498c.png

I am getting attached error I am unable to pass the vlaue from the text input could you please help me on this

Kishore-Infy avatar Mar 28 '19 12:03 Kishore-Infy

@Kishore-Infy This is a closed issue. Closed issues are not monitored. Please ask a question on Stack Overflow using the Bot Framework tag https://stackoverflow.com/questions/tagged/botframework The Bot Framework Support team monitors Stack Overflow, and will assist you there.

EricDahlvang avatar Mar 28 '19 16:03 EricDahlvang