Submit Button Behavior in Consecutive Adaptive Cards
Discussed in https://github.com/microsoft/AdaptiveCards/discussions/9097
Originally posted by ritwickbhargav80 January 25, 2025 I'm encountering an issue in Microsoft Copilot Studio where the submit button on a previous adaptive card inadvertently triggers the submission of subsequent adaptive cards.
Detailed Issue: When multiple adaptive cards are present in a conversation flow:
- Let's say the bot presents one adaptive card.
- Upon submitting that adaptive card there is another adaptive card for confirmation let's call it second adaptive card.
- If I click the submit button on the first adaptive card again; it submits the second adaptive card.
- This unexpected behavior leads to unintended actions or data submissions.
Steps to Reproduce:
- Create a new Agent in Microsoft Copilot Studio.
- Create another topic as "Order Products" (Here is the YAML code: https://codefile.io/f/N0wXWGNmIk)
- Type "Order Products" in Test your agent pane
- It should display you an adaptive card as "Product Order Form"
- You fill that form and click on "Next" button
- It should display you another adaptive card as "Order Confirmation"
- Don't click on any of the button present in "Order Confirmation" adaptive card and click on the "Next" button of "Product Order Form"
- You'll see it bypasses that confirmation and moves to "All Other Conditions" scenario
Expected Behaviour:
- The submit button on each adaptive card should only trigger the submission of data associated with that specific card.
- Subsequent adaptive cards should only be submitted when their respective submit buttons are clicked.
Queries:
- I would like to know if this behavior is intended or if there's a way to disable or control the submission behavior of previous adaptive cards from Adaptive Card or Microsoft Copilot Studio?
- If this functionality is not yet available, are there any recommended best practices, alternative approaches or workarounds to handle this scenario with Adaptive Cards or from the Microsoft Copilot Studio?
@ritwickbhargav80 - Thank you for bringing this issue to our attention. The issue you’re encountering with the adaptive cards in Microsoft Copilot Studio, where the submit button on a previous adaptive card inadvertently triggers the submission of subsequent adaptive cards, is not the expected behavior. Each adaptive card’s submit action should be isolated to that specific card. Here are some steps and recommendations to control the submission behavior:
Could you please verify the below points: Isolate Submit Actions: Ensure that each adaptive card has its own unique id and action handlers. This can help ensure that the submit action on one card does not interfere with another.
Use AdaptiveSubmitAction with Unique Data: When defining the AdaptiveSubmitAction for each card, include unique identifiers or data payloads that can help differentiate between the cards during submission.
Check for Event Handling Logic: Verify the event handling logic in your bot to ensure that submit actions are being processed correctly and are not inadvertently affecting other cards.
Debug and Log: Add detailed logging to your bot’s event handling code to capture the sequence of actions and identify where the unintended submissions are occurring.
Please let us know if you have any further query here.
@ritwickbhargav80 - Have you verified the above suggested points or are you still facing this issue?
Hi @Nivedipa-MSFT ,
Isolated Submit Actions: Yes we've Isolated Submit Actions. Even we tried segregation of Adaptive cards in different topics (for ex: Adaptive Card 1 in one topic and Adaptive Card 2 in another topic) but that doesn't work as well. The previous adaptive card submit behaviour interferes with the next adaptive card.
Use AdaptiveSubmitAction with Unique Data: Are you suggesting we need to add a condition to check which actionSubmitId is getting submitted every time and in every flow? In my opinion, either the previous button of Adaptive Card should be disabled or shouldn't have any effect.
FYI, I've added the code as well for Microsoft Copilot Studio to replicate my scenario.
So, the expected flow is like the following:
- User Intent Identified as "Order product"
- ADAPTIVE CARD 1: Show an adaptive card to capture user's product input
- ADAPTIVE CARD 2: Take confirmation from the user whether he wasn't to place an order.
- Based on submission from ADAPTIVE CARD 2 the bot should send a message
- Once the ADAPTIVE CARD 2 has been rendered; even if the user click on submit action of ADAPTIVE CARD 1; it shouldn't have any effect.
Currently the issue lies in Step 5 of expected flow which allows the bot to bypass the ADAPTIVE CARD 2 submission if user clicks on submit action of ADAPTIVE CARD 1.
Thanks!
We will check and update you soon.
Hello @ritwickbhargav80 - We are having trouble repro'ing this issue. Could you please help providing repro video or deployed app, so that it would be easier for us to investigate and raise a bug accordingly?
Hello @ritwickbhargav80 - We are having trouble repro'ing this issue. Could you please help providing repro video or deployed app, so that it would be easier for us to investigate and raise a bug accordingly?
@Nivedipa-MSFT @ritwickbhargav80 We are experiencing the same issue. HAs there been any resolution for this yet?
@Nivedipa-MSFT @ritwickbhargav80 , i'm having the same issue but my problem is more about the same adaptive card for different trigger. If you clicking submit button from any of the adaptive cards, it will trigger the following steps for all of the adaptive card. Please refer to the following screenshot for detail.
@HaoqingCai I believe you can simply add "Cancel All Topics" at the end of the flow.
Hi @ritwickbhargav80, @Nivedipa-MSFT, @HaoqingCai, @itinerispierrickserranne
I’m also facing the problem in Microsoft Copilot Studio where clicking the submit button on a previous adaptive card also triggers the next card.
Has anyone solved this? Or is there a workaround to stop the first card from affecting the next one?
Thanks!
Hi @ritwickbhargav80 @Nivedipa-MSFT @
We have same issue as well, where clicking the submit button on a previous adaptive card in copilot studio also triggers the next card. Any suggestions ?