Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
How to prevent remote error message from displaying when using JustValidate remote option?

I am using JustValidate library (https://github.com/horprogs/Just-validate) for form validation. It works perfectly on the client-side, but seems to not work properly when executing remote validation. For instance: If we have an input field "email" the remote validation in our Javascript would look like the code below.

rules: {
    email: {
        email: true,
        remote: {
            url: '@Url.Action("Validate", "ActivityTypes")',
            sendParam: 'email',
            successAnswer: 'OK',
            method: 'GET'
        }
    }
}

Every time user inputs something in the e-mail input, value is sent to server and checked if it's okay or not. The problem is you always get a response OK. And every time you get that response the error message for the input shows (Even if the input has been filled out correctly). My controller action looks like this:

public async Task<IActionResult> Validate(ActivityType values)
    {
        var activityType = await _context.ActivityType
           .FirstOrDefaultAsync(m => m.Name == values.Name);
        if (activityType == null)
        {
           return NotFound();
        }



        return Ok();
}

I have already tried redirecting from one action to another in the controller, returning NotFound() but am still getting the Ok response, and the error message shows up again. When trying the demos on the JustValidate library's GitHub page I noticed that inputs are always showing error messages for the input "email", even when they shouldn't. Has anyone found a workaround? I have already used this library on 80% of all my form and don't want to change it for some other library.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Since you mentioned successAnswer: 'OK' you need to return the response as Content. Like this.

[HttpGet]
[Route("check-exists")]
public IActionResult CheckExists(string email)
{
    return email == "anuraj@example.com" ? Content("Not Okay") : Content("OK");
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda