Client-side validation with Dataannotations only works on localhost

Asked

Viewed 1,138 times

1

I’ve been doing research for three days and I haven’t seen anything like this anywhere else.

Checking if it was some kind of hosting block, I hosted the site on godaddy, and then on Azure to confirm, and continued the same thing.

To summarize the problem: Client-side validation works only on the localhost, when I publish the web application, this validation stops working. Only the error message does not appear, the rest works normally.

I use visual studio 2013. I am using MVC and Dataannotations as follows in my Patient model:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Linq;
    using System.Web;
    using Maoli.Mvc;

    namespace ALLIVICI.Models
    {
    public partial class tbPaciente
    {
    public tbPaciente()
    {
    this.tbMedico_Paciente = new List<tbMedico_Paciente>();
    }
    [Key]
    public int IdPaciente { get; set; }

    [Required(ErrorMessage = "Esse campo é obrigatório")]
    [StringLength(100, ErrorMessage = "Esse campo deve conter no máximo 100 letras")]
    [RegularExpression("^([^0-9])*$", ErrorMessage = "Esse campo não deve conter números")]
    public string Nome { get; set; }

    //[Required(ErrorMessage = "Esse campo é obrigatório")]"^[A-Za-z0-9](([_.-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([.-]?[a-zA-Z0-9]+)*)([.][A-Za-z]{2,4})$"
    //public string Email { get; set; }

    //[Required(ErrorMessage = "Esse campo é obrigatório")]
    [RegularExpression("(^[A-Za-z]{2}[-][0-9]{2}[.][0-9]{3}[.][0-9]{3})$", ErrorMessage = "Por favor, preencha o campo no formato: AA-00.000.000")]
    public string RG { get; set; }

    [RegularExpression("^[0-9]{11}$", ErrorMessage = "Esse não é um CPF válido")]
    [Required(ErrorMessage = "Esse campo é obrigatório")]
    [Cpf(ErrorMessage = "Esse CPF não existe! Por favor, informe um CPF válido.")]
    public string CPF { get; set; }
    //"(^\d{3}.\d{3}.\d{3}-\d{2}$)|(^\[0-9]{11}$)|(^_{3}\._{3}\._{3}-_{2}$)"

    [Required(ErrorMessage = "Esse campo é obrigatório")]
    [RegularExpression("^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/](19|20)[0-9][0-9](( )([0-9][0-9][:]){2}[0-9][0-9])?", ErrorMessage = "Por favor, preencha o campo no formato 01/01/2000")]
    [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
    public System.DateTime DataNascimento { get; set; }

    public string NomeResponsavel { get; set; }

    public string Sexo { get;set; }      

    public int Etnia { get; set; }

    public string Endereco { get; set; }

    public string Bairro { get; set; }

    [RegularExpression("^[(]{1}[1-9]{2}[)]{1}[0-9]{4}[-]{1}[0-9]{3,4}$", ErrorMessage = "Por favor, preencha o campo no formato: (00)1234-5678")]
    public string TelResidencial { get; set; }

    [RegularExpression("^[(]{1}[1-9]{2}[)]{1}[0-9]{4}[-]{1}[0-9]{3,4}$", ErrorMessage = "Por favor, preencha o campo no formato: (00)1234-5678")]
    public string TelComercial { get; set; }

    [RegularExpression("^[(]{1}[1-9]{2}[)]{1}[0-9]{4,5}[-]{1}[0-9]{3,4}$", ErrorMessage = "Por favor, preencha o campo no formato: (00)1234-5678 ou (00)12345-6789")]
    public string TelCelular { get; set; }

    public string Profissao { get; set; }
    public bool FlgAtleta { get; set; }
    public bool FlgGestante { get; set; }

    public virtual ICollection<tbMedico_Paciente> tbMedico_Paciente { get; set; }

In my _Layout I have the following code including the rendering of scripts:

        @using Microsoft.AspNet.Identity

        <!DOCTYPE html>
        <html>
        <head>
        <meta charset="utf-8" />
        @*<a href="~/Views/Shared/_LoginPartial.cshtml">~/Views/Shared/_LoginPartial.cshtml</a>*@
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>@ViewBag.Title - ALLIVICI</title>
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
        </head>
        <body>
        @if (!Request.IsAuthenticated)
        {
            <center><h2>Em construção</h2></center>
        }
        @if (Request.IsAuthenticated)
        {
            if (!HttpContext.Current.Request.Url.AbsolutePath.Equals("/tbProfs/Create"))
            {
            <div class="navbar navbar-inverse navbar-fixed-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        @Html.ActionLink("ALLIVICI", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
                    </div>
                    <div class="navbar-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li>@Html.ActionLink("Inicio", "Index", "Home")</li>
                            <li>@Html.ActionLink("Sobre", "About", "Home")</li>
                            <li>@Html.ActionLink("Contato", "Contact", "Home")</li>
                        </ul>
                        @Html.Partial("_LoginPartial")
                    </div>
                </div>     
            </div>
            }
        }
        <div class="container">
        @if (Request.IsAuthenticated)
        {
            if (!HttpContext.Current.Request.Url.AbsolutePath.Equals("/tbProfs/Create"))
            {
                @Html.Partial("_Menu")
            }
        }       
        </div>   

        <div class="container body-content">
            @RenderBody()
            <hr />
            <footer>
                <p>&copy; @DateTime.Now.Year</p>
                @*<div align="right"></div>*@
            </footer>
        </div>
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/bootstrap")
        @RenderSection("scripts", required: false)
        </body>
        </html>

In my Bundleconfig.Cs I just added Maoli:

    using System.Web;
    using System.Web.Optimization;

    namespace ALLIVICI
    {
        public class BundleConfig
        {
            // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
            public static void RegisterBundles(BundleCollection bundles)
            {
                bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                            "~/Scripts/jquery-{version}.js"));

                bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                            "~/Scripts/jquery.validate*",
                            "~/Scripts/maoli*"
                            ));

                // Use the development version of Modernizr to develop with and learn from. Then, when you're
                // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
                bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                            "~/Scripts/modernizr-*"));

                bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                          "~/Scripts/bootstrap.js",
                          "~/Scripts/respond.js"));

                bundles.Add(new StyleBundle("~/Content/css").Include(
                          "~/Content/bootstrap.css",
                          "~/Content/site.css"));
            }
        }
  }

I have a simple controller:

    // POST: tbPaciente/Create
    // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
    // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Create([Bind(Include = "Nome,RG,CPF,DataNascimento,NomeResponsavel,Sexo,Etnia,Endereco,Bairro,IdCidade,TelResidencial,TelComercial,TelCelular,Profissao,FlgAtleta,FlgGestante")] tbPaciente tbPaciente, [Bind(Include = "InformacaoResumida")] tbMedico_Paciente tbMP)
    {
        var idU = User.Identity.GetUserId();

        tbMP.IdPaciente = tbPaciente.IdPaciente; //var y = db.tbProfs.Where(x => x.IdUser.Equals(id)); //y e w são iguais.
        var w = from c in db.tbProfs
                where (c.IdUser == idU)
                select c;
        tbMP.IdProf = w.Single().IdProf;

        //var k = from d in db.tbMedico_Paciente
        //        where (w.Single().IdProf == d.IdProf)
        //        where (d.IdPaciente == tbPaciente.IdPaciente)
        //        select d;

        if (ModelState.IsValid)
        {
            db.tbPacientes.Add(tbPaciente);
            db.tbMedico_Paciente.Add(tbMP);
            await db.SaveChangesAsync();
            return RedirectToAction("Index");
        }

        ViewBag.IdCidade = new SelectList(db.tbCidades, "IdCidade", "nome", tbPaciente.IdCidade);
        return View();
    }

And finally, my web.config if it helps at all:

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=301880
      -->
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>
      <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=archanjo\sqlnovo;Initial Catalog=db_ALL;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
        <add name="db_ALLContext" connectionString="Data Source=archanjo\sqlnovo;Initial Catalog=db_ALL;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
      </connectionStrings>
      <appSettings>
        <add key="webpages:Version" value="3.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
      <system.web>
        <globalization culture="pt-BR" uiCulture="pt-BR" />
        <authentication mode="None" />
        <compilation debug="true" targetFramework="4.6" />
        <httpRuntime targetFramework="4.6" />
        <customErrors mode="Off" />
        <trust level="Full" />
      </system.web>
      <system.webServer>
        <modules>
          <remove name="FormsAuthentication" />
        </modules>
        <handlers>
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <remove name="OPTIONSVerbHandler" />
          <remove name="TRACEVerbHandler" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
        </handlers>
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
            <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="Data Source=archanjo\sqlnovo;Initial Catalog=db_ALL;Integrated Security=True;MultipleActiveResultSets=True" />
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
      </entityFramework>
    </configuration>

When I publish, the database connection string is automatically changed to the database on the correct server.

I almost forgot the Patient’s View...

                    @using Microsoft.AspNet.Identity
        @using System.Web.Mvc.Html;


        @model ALLIVICI.Models.tbPaciente

        @{
            ViewBag.Title = "Create";
        }

        <h2>Adicionar</h2>

        @using (Html.BeginForm())
        {

            @Html.AntiForgeryToken()

            <div class="form-horizontal">

                <h4>Paciente</h4>
                <hr />
                @Html.ValidationSummary(true, "", new { @class = "text-danger" })

                <div class="form-group">
                    @Html.LabelFor(model => model.Nome, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.Nome, new { htmlAttributes = new { @class = "form-control", @placeholder = "Nome completo" } })
                        @Html.ValidationMessageFor(model => model.Nome, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.RG, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.RG, new { htmlAttributes = new { @class = "form-control", @placeholder = "ES-11.111.111" } })
                        @Html.ValidationMessageFor(model => model.RG, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.CPF, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @*<script type="text/javascript">$(document).ready(function(){  $("#cpf").mask("99999999999");});</script>*@
                        @Html.EditorFor(model => model.CPF, new { htmlAttributes = new { @class = "form-control", @placeholder = "11122233300"} })
                        @*@Html.ValidateFor(model => model.CPF)*@
                        @Html.ValidationMessageFor(model => model.CPF, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.DataNascimento, "Nascimento", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.DataNascimento, new { htmlAttributes = new { @class = "form-control", @placeholder = "01/01/1900" } })
                        @Html.ValidationMessageFor(model => model.DataNascimento, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.NomeResponsavel, "Responsável", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.NomeResponsavel, new { htmlAttributes = new { @class = "form-control", @placeholder = "Se menor de 18 anos" } })
                        @Html.ValidationMessageFor(model => model.NomeResponsavel, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Sexo, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.DropDownListFor(model => model.Sexo, new SelectList(new[]
                               {
                                   new SelectListItem {Text = "M", Value = "Masculino"},
                                   new SelectListItem {Text = "F", Value = "Feminino"},
                               }, "Text", "Value"), htmlAttributes: new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.Sexo, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Etnia, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @*@Html.EditorFor(model => model.Etnia, new { htmlAttributes = new { @class = "form-control" } })*@
                        @Html.DropDownListFor(model => model.Etnia, new SelectList(new[]
                               {
                                   new SelectListItem {Text = "0", Value = "Branco"},
                                   new SelectListItem {Text = "1", Value = "Índio"},
                                   new SelectListItem {Text = "2", Value = "Negro"},
                                   new SelectListItem {Text = "3", Value = "Oriental"},
                                   new SelectListItem {Text = "4", Value = "Pardo"},
                               }, "Text", "Value"), htmlAttributes: new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.Etnia, "", new { @class = "text-danger" })
                    </div>
                </div>


                <div class="form-group">
                    @Html.LabelFor(model => model.Endereco, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.Endereco, new { htmlAttributes = new { @class = "form-control", @placeholder = "Rua, número, logradouro" } })
                        @Html.ValidationMessageFor(model => model.Endereco, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Bairro, htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.Bairro, new { htmlAttributes = new { @class = "form-control", @placeholder = "Bairro" } })
                        @Html.ValidationMessageFor(model => model.Bairro, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.IdCidade, "Cidade", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.DropDownList("IdCidade", null, htmlAttributes: new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.IdCidade, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.TelResidencial, "Tel. Residencial", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.TelResidencial, new { htmlAttributes = new { @class = "form-control", @placeholder = "(00)1234-5678" } })
                        @Html.ValidationMessageFor(model => model.TelResidencial, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.TelComercial, "Tel. Comercial", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.TelComercial, new { htmlAttributes = new { @class = "form-control", @placeholder = "(00)1234-5678" } })
                        @Html.ValidationMessageFor(model => model.TelComercial, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.TelCelular, "Celular", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.TelCelular, new { htmlAttributes = new { @class = "form-control", @placeholder = "(00)1234-5678 ou (00)12345-6789" } })
                        @Html.ValidationMessageFor(model => model.TelCelular, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Profissao, "Profissão", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.Profissao, new { htmlAttributes = new { @class = "form-control", @placeholder = "Ocupação principal" } })
                        @Html.ValidationMessageFor(model => model.Profissao, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.FlgAtleta, "Atleta", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        <div class="checkbox">
                            @Html.CheckBoxFor(model => model.FlgAtleta)
                            @Html.ValidationMessageFor(model => model.FlgAtleta, "", new { @class = "text-danger" })
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.FlgGestante, "Gestante", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        <div class="checkbox">
                            @Html.CheckBoxFor(model => model.FlgGestante)
                            @Html.ValidationMessageFor(model => model.FlgGestante, "", new { @class = "text-danger" })
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.tbMedico_Paciente.Where(x => x.tbProf.IdUser.Equals(User.Identity.GetUserId())).Single().InformacaoResumida, "Informação Extra", htmlAttributes: new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.EditorFor(model => model.tbMedico_Paciente.Where(x => x.tbProf.IdUser.Equals(User.Identity.GetUserId())).Single().InformacaoResumida, new { htmlAttributes = new { @class = "form-control" } })
                        @Html.ValidationMessageFor(model => model.tbMedico_Paciente.Where(x => x.tbProf.IdUser.Equals(User.Identity.GetUserId())).Single().InformacaoResumida, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <input type="submit" value="Salvar" class="btn btn-default" />
                    </div>
                </div>
            </div>
        }

        <div>
            @Html.ActionLink("Voltar para lista de pacientes", "Index")
        </div>

        @section Scripts {
            @Scripts.Render("~/bundles/jqueryval")
        }

Any additional information anyone needs to help me, just ask.

Any help, any help, will be welcome. Thank you.

EDIT: Guys, thank you to everyone. I made a minimal example according to Sergio and Brasofilo and... it worked. I then got a version 0.1 from two weeks ago, when I had not yet hosted, and it also worked... In this way, I added little by little in version 0.1 what I had done in these two weeks to find out what was wrong. To my surprise, I finished adding everything and no error occurred. To be sure, in the end, I copied all models, controllers and views of the other to version 0.1 and even then it worked normally. Until I realized that the only difference that remained were the en-br translation packages and the Maoli of the Nuget Manage that one had and the other did not. The problem was right there, I uninstalled all these from the old one and it worked too. Now, I’m going to add the packages to each other in a trial version and see which caused the error in my program, or even if it was the interaction between each other. Thanks guys, finding out, put here.

EDIT2: Guys, it might end the matter. It looks like it was some conflict with the Maoli package, although I don’t know exactly what. Thank you all.

  • The not working would be what, it displays nothing, someone error?

  • It does not display the validation error message. The rest works.

  • Do you use any dependency injection? Type ninject?

  • No use. (To tell you the truth, I had to search about addiction injection in google to be able to answer you...). Thank you for your attention.

  • Your Patient view is to edit the object, but in the control you put Create, it should send to the create itself?

  • Sorry, I put it wrong, I’ll fix it now. However, it’s basically the same thing.

  • 2

    Can you shorten the question? It makes it difficult to read everything. If you are more specific it is easier to help you.

  • 1

    Check out this guide: http://answall.com/help/mcve

  • @Sergio It’s actually like that. All the information can be pertinent in understanding his problem.

  • Is there an error coming back in console? Validation necessarily needs to be in client or can be done on the server side?

  • Guys, thank you so much. I edited the question with an explanation of what I have done so far.

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.