Skip to content

Commit d20f3c0

Browse files
committed
fix(IpAddress): Re-write the validation for cells that have content consisting solely of blank spaces.
1 parent 42d026f commit d20f3c0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ protected override void OnParametersSet()
3636
var ipSegments = CurrentValueAsString.Split(".", System.StringSplitOptions.RemoveEmptyEntries);
3737
if (ipSegments.Length == 4)
3838
{
39-
Value1 = string.IsNullOrWhiteSpace(ipSegments[0]) ? "0" : ipSegments[0];
40-
Value2 = string.IsNullOrWhiteSpace(ipSegments[1]) ? "0" : ipSegments[1];
41-
Value3 = string.IsNullOrWhiteSpace(ipSegments[2]) ? "0" : ipSegments[2];
42-
Value4 = string.IsNullOrWhiteSpace(ipSegments[3]) ? "0" : ipSegments[3];
39+
Value1 = ipSegments[0];
40+
Value2 = ipSegments[1];
41+
Value3 = ipSegments[2];
42+
Value4 = ipSegments[3];
4343
}
4444
else
4545
{
@@ -54,7 +54,7 @@ protected override void OnParametersSet()
5454
private void ValueChanged1(ChangeEventArgs args)
5555
{
5656
Value1 = args.Value?.ToString();
57-
if (string.IsNullOrEmpty(Value1))
57+
if (string.IsNullOrWhiteSpace(Value1))
5858
{
5959
Value1 = "0";
6060
}
@@ -69,7 +69,7 @@ private void ValueChanged1(ChangeEventArgs args)
6969
private void ValueChanged2(ChangeEventArgs args)
7070
{
7171
Value2 = args.Value?.ToString();
72-
if (string.IsNullOrEmpty(Value2))
72+
if (string.IsNullOrWhiteSpace(Value2))
7373
{
7474
Value2 = "0";
7575
}
@@ -83,7 +83,7 @@ private void ValueChanged2(ChangeEventArgs args)
8383
private void ValueChanged3(ChangeEventArgs args)
8484
{
8585
Value3 = args.Value?.ToString();
86-
if (string.IsNullOrEmpty(Value3))
86+
if (string.IsNullOrWhiteSpace(Value3))
8787
{
8888
Value3 = "0";
8989
}
@@ -97,7 +97,7 @@ private void ValueChanged3(ChangeEventArgs args)
9797
private void ValueChanged4(ChangeEventArgs args)
9898
{
9999
Value4 = args.Value?.ToString();
100-
if (string.IsNullOrEmpty(Value4))
100+
if (string.IsNullOrWhiteSpace(Value4))
101101
{
102102
Value4 = "0";
103103
}

0 commit comments

Comments
 (0)