question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should Input.Number value accept a string?

See original GitHub issue

Issue

Every version of the schema I’ve seen says the value property of Input.Number only accepts a number.

image

However, I’ve tried using a string for the value in both Web Chat and Microsoft Teams and they work. Both of these inputs render the same:

{
  "type": "Input.Number",
  "id": "id-number",
  "value": 7,
  "placeholder": "Placeholder text"
},
{
  "type": "Input.Number",
  "id": "id-numberString",
  "value": "7",
  "placeholder": "Placeholder text"
},

Which is correct? Should the schema say “number, string” instead of just number? Or are those renderers operating contrary to the schema?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
corinagumcommented, Oct 31, 2019

+1, though behavior has changed slightly. On Web Chat, we have used “value”: 1 in the past, which would show the default value as 1. However when bumping to 1.23 recently there was a change where the 1 is no longer inserted as a value, so the input is blank. “value”: “1” does work, however.

{
  "$schema": "https://microsoft.github.io/AdaptiveCards/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.2",
  "body": [
    {
      "type": "Input.Number",
      "placeholder": "Quantity",
      "min": -5,
      "max": 5,
      "value": 1,
      "id": "NumVal",
      "speak": "How many do you want?"
    }
  ]
}

The above code shows an empty input in the visualizer.

Particularly in contrast with the min and max properties, this seems like an odd inconsistency.

For now Web Chat is using the workaround. 😃

0reactions
msftbot[bot]commented, Dec 4, 2020

Thanks for looking into this stale issue shalinijoshi19; Resetting staleness. @v-kydela FYI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML input type="number" still returning a string when ...
there is nothing you can do. HTML Input element is documented to return the value in String type representing number. See my explanation...
Read more >
Why the number input is the worst input
When the number input contains an invalid value and you retrieve the value, you get a blank string. · Valid numbers include more...
Read more >
Why take a String input instead of int input for a number?
5 Answers 5 ... Simply because the user's guess is most probably entered through a mechanism which only supports entering chars, or strings,...
Read more >
<input type="number"> - HTML: HyperText Markup Language
A number input is considered valid when empty and when a single number is entered, but is otherwise invalid. If the required attribute...
Read more >
Check user Input is a Number or String in Python
In this lesson, you will learn how to check user input is a number or string in Python. We will also cover how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found