Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
data-val-regex-pattern Error Don't Show In MVC C#

I have a field in .net core 2.3 have a requires regular expression validation. I use this Pattern in two views in one view work fine but in other one just show required error and both code is the same. my view mode :

    [Required(ErrorMessage = "لطفا تلفن خود را وارد کنید")]
    [RegularExpression(@"^((((\+)|(00?))?\d+[\s]?\d+)|(((\+)|(00?))?\d+[\s]?\d+(-((\+)|(00?))?\d+[\s]?\d+)*))$", ErrorMessage = "تلفن وارد شده نامعتبر است")]
    public string Phone { get; set; }

my view is :

                <label asp-for="LandingRequest.Phone" class="sr-only">تلفن یا موبایل</label>

                <input asp-for="LandingRequest.Phone" class="form-control dir-rtl english-phone" placeholder="تلفن یا موبایل">
                
                <span asp-validation-for="LandingRequest.Phone" class="text-danger"></span>

and generated HTML :

<input class="form-control dir-rtl english-phone input-validation-error" placeholder="تلفن یا موبایل" type="text" data-val="true" data-val-regex="تلفن وارد شده نامعتبر است" data-val-regex-pattern="^((((\+)|(00?))?\d+[\s]?\d+)|(((\+)|(00?))?\d+[\s]?\d+(-((\+)|(00?))?\d+[\s]?\d+)*))$" data-val-required="لطفا تلفن خود را وارد کنید" id="LandingRequest_Phone" name="LandingRequest.Phone" value="" aria-describedby="LandingRequest_Phone-error" aria-invalid="true">
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!