Skip to content

Commit

Permalink
Prevent decimal insertion in integer-only fields (#1868)
Browse files Browse the repository at this point in the history
Added a condition to check if the value is not an integer before allowing the insertion of a decimal separator when the 'NumpadDecimal' key is pressed. This ensures that decimal points are not inserted in fields restricted to integer values, maintaining their integrity.

Co-authored-by: Christian Storb <[email protected]>
  • Loading branch information
aibutler and Christian Storb authored Dec 19, 2024
1 parent 5c49ab3 commit 3506256
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Radzen.Blazor/wwwroot/Radzen.Blazor.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ window.Radzen = {
return;
}

if (e.code === 'NumpadDecimal') {
if (e.code === 'NumpadDecimal' && !isInteger) {
var cursorPosition = e.target.selectionEnd;
e.target.value = [e.target.value.slice(0, e.target.selectionStart), decimalSeparator, e.target.value.slice(e.target.selectionEnd)].join('');
e.target.selectionStart = ++cursorPosition;
Expand Down

0 comments on commit 3506256

Please sign in to comment.