Skip to content

Bug fix for phone field#1147

Open
JayanthT7 wants to merge 3 commits intosimplcommerce:masterfrom
JayanthT7:bugFix/jayanth/PhonetxtFields
Open

Bug fix for phone field#1147
JayanthT7 wants to merge 3 commits intosimplcommerce:masterfrom
JayanthT7:bugFix/jayanth/PhonetxtFields

Conversation

@JayanthT7
Copy link
Contributor

Code fix for Phone field accepting non numeric fields.

JayanthT7 and others added 3 commits February 14, 2026 23:18
Updated the README to include a pre-configured connection string for SQL Server LocalDB. This helps new contributors who have Visual Studio installed but do not have a standalone SQL Server instance running, lowering the barrier to entry for the project.
@JayanthT7
Copy link
Contributor Author

Hi @hishamco , Please review and approve the PR

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 8, 2026


[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?

<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.

Comment on lines +86 to +87
<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('');">
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, '')">

Comment on lines +178 to +179
<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('');">
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, '')">


[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.

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")]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants