Skip to content

Commit c4dd7a8

Browse files
authored
Update implementing-controls-using-typescript.md
The range input does not operate correctly with formatted numbers. The value should be set to the string representation of the raw value, not the formatted value. You can observe the incorrect behavior by choosing a slider value of 1000, which causes formatting to add a ",". [If the value is set to something which can't be converted into a valid floating-point number, validation fails because the input is suffering from a bad input.](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range) [If parseFloat encounters a character other than a plus sign (+), minus sign (- U+002D HYPHEN-MINUS), numeral (0–9), decimal point (.), or exponent (e or E), it returns the value up to that character, ignoring the invalid character and characters following it.](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat)
1 parent cd9d953 commit c4dd7a8

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

powerapps-docs/developer/component-framework/implementing-controls-using-typescript.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ export class TSLinearInputComponent
168168
this._value = context.parameters.sliderValue.raw
169169
? context.parameters.sliderValue.raw
170170
: 0;
171-
this.inputElement.value =
172-
context.parameters.sliderValue.formatted
173-
? context.parameters.sliderValue.formatted
174-
: "0";
171+
this.inputElement.value = this._value.toString();
175172
176173
this.labelElement.innerHTML = context.parameters.sliderValue.formatted
177174
? context.parameters.sliderValue.formatted
@@ -199,11 +196,7 @@ export class TSLinearInputComponent
199196
? context.parameters.sliderValue.raw
200197
: 0;
201198
this._context = context;
202-
this.inputElement.value =
203-
204-
context.parameters.sliderValue.formatted
205-
? context.parameters.sliderValue.formatted
206-
: "";
199+
this.inputElement.value = this._value.toString();
207200
208201
this.labelElement.innerHTML = context.parameters.sliderValue.formatted
209202
? context.parameters.sliderValue.formatted

0 commit comments

Comments
 (0)