AdaptiveCards icon indicating copy to clipboard operation
AdaptiveCards copied to clipboard

[MsTeams]Input.Number is not allowing more than 10 numbers

Open Chekrii opened this issue 6 years ago • 4 comments

Platform

  • .NetCore
  • BotFramework V4

Host

  • MS Teams

Hi All,

I am using Input.Number property to collect the phone number from the user. If the user enters the wrong number then I am pre-populating the same Adaptive card filling the number entered by the user.

If the value of number is more than 10 digits, input.number property is not allowing that number.

Please have a look at the Json:-

{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"My mobile number"},{"type":"Input.Number","placeholder":"","value":"**962213213213213**","id":"asdas"}],"$schema":"http://adaptivecards.io/schemas/adaptive-card.json"}

This is the error message from Teams App studio:- InputNumber

Please help.

Thanks.

Chekrii avatar Apr 25 '20 03:04 Chekrii

Thanks for reporting this @Chekrii. So Input.Number is supposed to be a Number type- specifically enforced as a double value in most of the renderers, including the .NET one and JS. After fixing your card to remove the non-number characters, I was able to see it render successfully on our designer (Adaptivecards.io/designer) as well as a quick app that uses our serialization SDK (.NET SDK v1.2.4) - both parsing values as double types ;

string card = "{\"type\":\"AdaptiveCard\",\"version\":\"1.0\",\"body\":[{\"type\":\"TextBlock\",\"text\":\"My mobile number\"},{\"type\":\"Input.Number\",\"placeholder\":\"\",\"value\":\"962213213213213\",\"id\":\"asdas\"}],\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\"}";

            try
            {
                var parseResult = AdaptiveCard.FromJson(card);
                //var attachment = new Attachment
                //{
                //    ContentType = AdaptiveCard.ContentType,
                //    Content = parsedResult.Card,
                //};
            }
            catch (AdaptiveSerializationException e)
            {
                // handle JSON parsing error
                // or, re-throw
                throw;
            }

In addition, I wonder if your problem will go away with the fix for #3829 where our JS renderer will be updated to allow both numbers and strings for backwards compatibility assuming this App Studio app actually hooks into the JS renderer and not .NET.

FWIW, I am able to repro the bug in Teams App Studio --> Card Editor for AdaptiveCards.. @siduppal / @dclaux / @matthidinger do you know who owns the code here, what AdaptiveCards renderer package it hooks to, and where Attachment type is defined (is it one of the built in Framework types?) - basically how do I debug it?

Thanks!

shalinijoshi19 avatar Apr 27 '20 20:04 shalinijoshi19

Hello @shalinijoshi19 , I am not able to render that card in teams using Bot framework.

Chekrii avatar Apr 28 '20 07:04 Chekrii

Thanks @chekrii; i believe that may be due to #3829. @paulcam206 any updates on that one yet? Thanks

shalinijoshi19 avatar Apr 29 '20 21:04 shalinijoshi19

This issue has been copied over to Microsoft Teams repo here: https://github.com/MicrosoftDocs/msteams-docs/issues/4773

Wajeed-msft avatar Dec 02 '21 21:12 Wajeed-msft