I need your help,
I have two forms, Form 1 Form 2
no Formulario 1
I have a date field, filling this date field I want it to copy to Formulario 2
without typing, can it do this using JAVASCRIPT
?
I can pull data from the other form through this line of code
Service
var dia1Service = new Basics.Services.Services.Formulario.Dia1Service();
Form
var dia1 = dia1Service.getByCadastroId(id);
Here is my validation with JAVASCRIPT:
function validaDataDois(campo, valor) {
var variavelBasais = @(dadosBasais.isubrar);
var variavelDia1 = @(dia1.isubrd1);
var date = new Date(valor.split('/').reverse().join('/'));
var dataAlta = $('[name="dtirr"]').val();
var dataAltaValida = new Date(dataAlta.split('/').reverse().join('/'));
var dateDia1 = '@(dia1 != null && !string.IsNullOrEmpty(dia1.dtd1) ? Convert.ToDateTime(dia1.dtd1).ToString("dd/MM/yyyy") : string.Empty)'
var dateDia1Valid = new Date(dateDia1.split('/').reverse().join('/'));
var dataRandomizado = '@Convert.ToDateTime(ViewBag.datarandomizacao.ToString()).ToString("dd/MM/yyyy")';
var dataRando = new Date(dataRandomizado.split('/').reverse().join('/'));
if (!isValidDate(valor)) {
$('#dtirr-msg').show();
$('#dtirr-msg').text('Data inválida: ' + dataAlta);
$('[name="dtirr"]').val('');
}else if(variavelBasais == "1"){
if(dataAltaValida < dataRando){
$('#dtirr-msg').show();
$('#dtirr-msg').text('A data informada está menor que a data de randomização: ' + dataRandomizado);
$('[name="dtirr"]').val('');
}
}else if(variavelDia1 == "1"){
// A DATA TEM QUE APARECER NESSE CAMPO ABAIXO
$('[name="dtirr"]').val();
}
else {
$('#dtirr-msg').hide();
$('.valida_btn').prop('disabled', false).attr('disabled');
}
}