Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -12,6 +13,9 @@ public class ShippingAddressVm

public string ContactName { get; set; }

[Required(ErrorMessage = "Phone number is required")]
[Phone(ErrorMessage = "Please enter a valid phone number")]
[StringLength(20, MinimumLength = 10, ErrorMessage = "Phone number must be between 10 and 20 characters")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 20 chars?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[StringLength(20, MinimumLength = 10, ErrorMessage = "Phone number must be between 10 and 20 characters")]
[StringLength(15, MinimumLength = 10, ErrorMessage = "Phone number must be between 10 and 15 characters")]

public string Phone { get; set; }

public string AddressLine1 { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
<div class="form-group row">
<label class="col-sm-4 col-form-label">@Localizer["Phone"]</label>
<div class="col-sm-8">
<input asp-for="NewAddressForm.Phone" type="text" class="form-control">
<input asp-for="NewAddressForm.Phone" type="tel"inputmode="numeric" class="form-control"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The phone can support formats like this +967-7-XXXXXXX.

oninput="this.value = this.value.split('').filter(function(c){return c >= '0' && c <= '9';}).join('');">
Comment on lines +86 to +87
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input asp-for="NewAddressForm.Phone" type="tel"inputmode="numeric" class="form-control"
oninput="this.value = this.value.split('').filter(function(c){return c >= '0' && c <= '9';}).join('');">
<input asp-for="NewAddressForm.Phone" type="tel" class="form-control" oninput="this.value = this.value.replace(/[^0-9+]/g, '')">

</div>
</div>
</div>
Expand Down Expand Up @@ -174,7 +175,8 @@
<div class="form-group row">
<label class="col-sm-4 col-form-label">@Localizer["Phone"]</label>
<div class="col-sm-8">
<input asp-for="NewBillingAddressForm.Phone" type="text" class="form-control">
<input asp-for="NewBillingAddressForm.Phone" type="tel" inputmode="numeric" class="form-control"
oninput="this.value = this.value.split('').filter(function(c){return c >= '0' && c <= '9';}).join('');">
Comment on lines +178 to +179
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input asp-for="NewBillingAddressForm.Phone" type="tel" inputmode="numeric" class="form-control"
oninput="this.value = this.value.split('').filter(function(c){return c >= '0' && c <= '9';}).join('');">
<input asp-for="NewBillingAddressForm.Phone" type="tel" class="form-control" oninput="this.value = this.value.replace(/[^0-9+]/g, '')">

</div>
</div>
</div>
Expand Down
Loading