I have two views, view1 = victims and view2 = reporter that are the same only change the name and the id of the person entered 1 = victim and 3 = whistleblower.
as a complainant I have a check that when checked would have to pull the victim's data,
The script that I use to pass the data from victim to whistleblower is:
function Victima(valor) {
if (valor == 1) {
$("#anonimo").attr("style", "display:none") // esto es para ocultar otro check
document.datos.PRIMER_NOMBRE.value = document.getElementById("PRIMER_NOMBREV").value
document.datos.SEGUNDO_NOMBRE.value = document.getElementById("SEGUNDO_NOMBREV").value
document.datos.TERCER_NOMBRE.value = document.getElementById("TERCER_NOMBREV").value
document.datos.PRIMER_APELLIDO.value = document.getElementById("PRIMER_APELLIDOV").value
document.datos.SEGUNDO_APELLIDO.value = document.getElementById("SEGUNDO_APELLIDOV").value
document.datos.APELLIDO_CASADA.value = document.getElementById("APELLIDO_CASADAV").value
document.datos.TELEFONO_CELULAR.value = document.getElementById("TELEFONO_CELULARV").value
document.datos.TELEFONO_CASA.value = document.getElementById("TELEFONO_CASAV").value
document.datos.TELEFONO_OTROS.value = document.getElementById("TELEFONO_OTROSV").value
} else {
$("#anonimo").removeAttr("style", "display:none")
}
}
I do what I need, BUT only in the input and I have several fields that I do not pull the data
My victim select is:
<label>10. Departamento:<b style="color:red">*</b></label>
<select class="form-control" id="DEPARTAMENTOV" name="DEPARTAMENTO" onchange="MunicipioDenunciante(this.value);" required>
<option value="99">Ignorado</option>
@foreach (var d in ValorDepto)
{
if (d.COD_DEPARTAMENTO == DEPARTAMENTO)
{
<option value="@d.COD_DEPARTAMENTO" selected id="DEPVALOR">@d.NOMBRE</option>
}
else
{
<option value="@d.COD_DEPARTAMENTO">@d.NOMBRE</option>
}
}
</select>
and I want to reflect it in the denunica selection:
<label>10. Departamento:<b style="color:red">*</b></label>
<select class="form-control" id="DEPARTAMENTOD" name="DEPARTAMENTO" onchange="MunicipioDenunciante(this.value);" required>
<option value="99">Ignorado</option>
@foreach (var d in ValorDepto)
{
if (d.COD_DEPARTAMENTO == DEPARTAMENTO)
{
<option value="@d.COD_DEPARTAMENTO" selected id="DEPVALOR">@d.NOMBRE</option>
}
else
{
<option value="@d.COD_DEPARTAMENTO">@d.NOMBRE</option>
}
}
</select>
I try this without success:
var cod = document.getElementById("DEPARTAMENTOV").value;
document.datos.DEPARTAMENTO.val(cod);