I have a form that by necessity has to be divided into 2 since the first part varies for some users and the second one may or may not vary, when dividing the form my first problem was that I could not validate the whole model because I was divided into 2 forms so validate it with javascript, after validating it I send it with the following code:
$.ajax({
type: 'POST',
url: '@Url.Action("RegisterDomicilio", "Account")',
dataType: 'HTML',
data: $("#RegisterDatos").serialize(),
success: function (data) {
}
});
in my driver I receive it without problem
[HttpPost]
[AllowAnonymous]
public ActionResult RegisterDomicilio(RegisterViewModel model)
{
switch (model.selectedTipousuarioId)
{
case 1:
model.Estados = GetEstados();
return View("RegistrarUsuarioDomicilio", model);
case 3:
model.Estados = GetEstados();
return View("RegistrarAlumnosDomicilio", model);
}
return View();
}
My problem comes when I want to address it from the controller to another form, it does not stay on the same original page.
Does anyone know how to redirect it well?
greetings