File tree Expand file tree Collapse file tree
src/Modules/SimplCommerce.Module.Checkouts/Areas/Checkouts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
3+ using System . ComponentModel . DataAnnotations ;
34using System . Linq ;
45using System . Text ;
56using System . Threading . Tasks ;
@@ -12,6 +13,9 @@ public class ShippingAddressVm
1213
1314 public string ContactName { get ; set ; }
1415
16+ [ Required ( ErrorMessage = "Phone number is required" ) ]
17+ [ Phone ( ErrorMessage = "Please enter a valid phone number" ) ]
18+ [ StringLength ( 20 , MinimumLength = 10 , ErrorMessage = "Phone number must be between 10 and 20 characters" ) ]
1519 public string Phone { get ; set ; }
1620
1721 public string AddressLine1 { get ; set ; }
Original file line number Diff line number Diff line change 8383 <div class =" form-group row" >
8484 <label class =" col-sm-4 col-form-label" >@Localizer ["Phone"]</label >
8585 <div class =" col-sm-8" >
86- <input asp-for =" NewAddressForm.Phone" type =" text" class =" form-control" >
86+ <input asp-for =" NewAddressForm.Phone" type =" tel" inputmode =" numeric" class =" form-control"
87+ oninput =" this.value = this.value.split('').filter(function(c){return c >= '0' && c <= '9';}).join('');" >
8788 </div >
8889 </div >
8990 </div >
174175 <div class =" form-group row" >
175176 <label class =" col-sm-4 col-form-label" >@Localizer ["Phone"]</label >
176177 <div class =" col-sm-8" >
177- <input asp-for =" NewBillingAddressForm.Phone" type =" text" class =" form-control" >
178+ <input asp-for =" NewBillingAddressForm.Phone" type =" tel" inputmode =" numeric" class =" form-control"
179+ oninput =" this.value = this.value.split('').filter(function(c){return c >= '0' && c <= '9';}).join('');" >
178180 </div >
179181 </div >
180182 </div >
You can’t perform that action at this time.
0 commit comments