Skip to content

Commit 76bd44d

Browse files
authored
Update implementing-controls-using-typescript.md
There is problem with the operation of the slider when the value is formatted. The range slider value should be set to the raw value converted to a string, not the formatted value. When you set the slider to 1000 it tries to use "1,000" which is not a valid float, and it behave erratically. [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 76bd44d

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)