microsoft / microsoft/AdaptiveCards

Input Number Triggering Validation when empty and isRequired false

Open
#8,347 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Renderers Bug Platform-JavaScript
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Problem Description

When we have Input Number with Max or Min field set but isRequired set to false we should be able to submit with empty number field similar to Date and Time input. But this is not the case with Number Input, instead validation occurs as if isRequired is set to true.

I have attached a JSON with Number Input and Date Input. Both of these components have min and max properties set to some values. When I try to submit without entering anything validation occurs only for Number Input. Is there any reason for this behavior?

Card JSON
{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.3",
    "body": [
        {
            "type": "Input.Number",
            "placeholder": "Placeholder text",
            "id": "number",
            "min": 1,
            "max": 10,
            "label": "Number Input, Min: 1, Max: 10"
        },
        {
            "type": "Input.Date",
            "id": "date",
            "min": "2023-01-01",
            "max": "2023-12-31",
            "label": "Date Input, Min: 1-Jan-2023, Max: 31-Dec-2023"
        }
    ],
    "actions": [
        {
            "type": "Action.Submit",
            "title": "Action.Submit"
        }
    ]
}
Screenshot

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Adaptive Card JSON and compare empty Input.Number validation with Input.Date when min and max are set and isRequired is false. Trace the validation entry point used for these inputs, then verify that an empty optional number submits successfully while required and out-of-range validation still behaves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.