Latest version from CDN
Adaptive inputs of type Input.Number don't display the value 0.

Steps to reproduce:
Bot Framework WebChat as the host appCard Payload Editor:This card was created using the C# AdaptiveCards package 1.2.0
This card will render correctly in the Emulator
[Bug]
I was able to reproduce this by sending the same json to Mock Bot for rendering
copy-pasting the json to the Adaptive Cards schema reproduces this issue, but manually assigning the value 0 in the schema editor shows the value 0 as expected.
Was able to replicate.
Wrapping the 0 with quotation marks seems to work.
Other values work with and without the quotation marks.
This issue is possibly related to a verification if the input has a value or not.
Using the browser console you can assert the following:
true && 10 => true
true && "10" => true
true && "0" => true
true && 0 => false
This card was created using the C# Adaptive Cards package
Will update the issue with this info
@jodufra
It looks like Adaptive Card's Input class's parse method uses the getStringValue utility to set the input's default value. The function uses a ternary to either return the value set in the Adaptive Card JSON as a string or the default value which would be undefined. In the case of the value being 0, the getStringValue function would return undefined.
parse(json: any, errors?: Array<HostConfig.IValidationError>) {
super.parse(json, errors);
this.id = Utils.getStringValue(json["id"]);
this.defaultValue = Utils.getStringValue(json["value"]);
if (AdaptiveCard.useBuiltInInputValidation) {
let jsonValidation = json["validation"];
if (jsonValidation) {
this.validation.parse(jsonValidation);
}
}
}
export function getStringValue(obj: any, defaultValue: string = undefined): string {
return obj ? obj.toString() : defaultValue;
}
The getStringValue method would likely have to be changed to check if the value is not undefined or equals zero.
export function getStringValue(obj: any, defaultValue: string = undefined): string {
return (obj || obj === 0) ? obj.toString() : defaultValue;
}
@jodufra
I opened an issue in the Adaptive Cards Repo. You can track it here https://github.com/microsoft/AdaptiveCards/issues/3237. Thank you for pointing out this issue.
Adaptive Cards just merged a fix for this issue. Should be resolved in Web Chat when we bump to the next version.
Most helpful comment
I was able to reproduce this by sending the same json to Mock Bot for rendering
copy-pasting the json to the Adaptive Cards schema reproduces this issue, but manually assigning the value 0 in the schema editor shows the value 0 as expected.