Fixed: An Adaptive Card Number Input in Teams Changes to Its Maximum Instead of Showing the Error Message
An Adaptive Card number box allowed 1 to 4, with an error message for anything else. In Microsoft Teams, I typed 6 and waited for the message. It never came: when I left the box, the 6 turned into a 4, and the card sent 4 to the agent.
What I Was Doing
I was testing a card for an agent in Teams: a ticket order with one Input.Number that accepts 1 to 4 tickets. The card set min, max and an errorMessage, so that Teams could stop a wrong number before it reached the agent:
{
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{ "type": "TextBlock", "text": "Concert tickets", "size": "Large", "weight": "Bolder" },
{
"type": "Input.Number",
"id": "tickets",
"label": "Tickets (1 to 4)",
"min": 1,
"max": 4,
"value": 1,
"errorMessage": "Pick from 1 to 4 tickets."
}
],
"actions": [
{ "type": "Action.Submit", "title": "Buy", "data": { "card": "tickets" } }
]
}
The agent, built with the Microsoft 365 Agents SDK, sends the card and replies with the values the card sends back.
What I Expected
Type 6, select Buy, and see Pick from 1 to 4 tickets. under the box, with nothing sent.
What I Got
While I typed, the box showed 6:

When I left the box, it showed 4, with no message:

And Buy sent 4. Teams added its Your response was sent to the app note, and the agent's reply showed what it got:

{"card":"tickets","tickets":"4"}
Below the minimum, it was the same in the other direction: 0 turned into 1. The error message didn't show either way.
What I Checked
That it wasn't my test. I typed 6 with the keyboard, the way a person does, and read the box's value before and after leaving it: 6, then 4.
What the schema says about min and max. Microsoft's Adaptive Cards schema describes both as hints: Hint of maximum value (may be ignored by some clients). So a host decides what to do with them.
What the input validation guide says. Microsoft's Input Validation page lists min and max as the validation properties of Input.Number, and then explains exactly this: Min and max properties (including maxLength) on some platforms may be enforced directly by the control. For example, a min property on Input.Date may be enforced by not allowing users to select a date before the minimum in a date picker. In that case, the error message may not be shown.
Why It Happens
Teams' number box enforces min and max itself: it moves any number outside the range to the nearest limit as soon as you leave the box. So the number is never out of range when the card checks its inputs, and errorMessage has nothing to report. That's what the guide allows for.
The Fix
There's no setting that makes Teams show the message instead. Design for what it does:
- Say the range in the label, as
Tickets (1 to 4)does, so a number that changes on its own isn't a surprise. - Keep
errorMessagefor the cases a host does report: other clients may not enforceminandmaxin the box, and Teams does show the error message of a required input left empty, as it did for a required drop-down list in my tests. - Check the number in your agent before you use it. The card's checks are a convenience for the person; the agent is the one that has to be right, whatever client sent the value. Card values arrive as text, so parse them first:
// tickets is the card's "tickets" value, as text.
if (!int.TryParse(tickets, out int count) || count < 1 || count > 4)
{
// Tell the person the range, and don't place the order.
}
After the Fix
The card says its range up front, Teams keeps every value inside it, and the agent's own check covers any client that doesn't. In Teams, the agent received 4 for a typed 6, as shown above: the number the person could see in the box before selecting Buy.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Relying on errorMessage to tell people the range | In Teams, it never shows for min or max | Put the range in the label |
Trusting the number because the card has max | Other clients may not enforce it | Check it in the agent |
| Treating the value as a number | It arrives as text, "4" | Parse it with int.TryParse |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| A number changes when you leave the box | Teams enforces min and max in the box | Expected: show the range in the label |
| The card sends a different number than was typed | The box moved it to the nearest limit | Expected: the box shows the number that will be sent |
errorMessage never appears | Nothing is out of range by the time the card checks | Use it with isRequired, and check in the agent |
FAQ
Does this happen with Input.Text maxLength too?
The guide names maxLength among the properties a control may enforce. In Teams, a multi-line text box with maxLength of 300 stopped taking characters at 300, so its error message had nothing to report either.
Will other apps show the error message?
Possibly: the guide says enforcement happens on some platforms. That's one more reason to keep the message, and to check in the agent.
Conclusion
In Teams, an Adaptive Card number box with min and max moves numbers into the range itself, so its errorMessage doesn't appear for them. Microsoft's input validation guide expects this. Put the range in the label, keep the error message for other cases and clients, and let the agent check every number it receives.
Additional Resources
- Input Validation, on Microsoft Learn.
- Input.Number, on Microsoft Learn.
