У меня есть форма HTML со скриптом приложений и Bootstrap 4. В этой форме у меня есть поле ввода, и его значение берется из параметров в URL-адресе. Когда я передаю параметр в поле, мне нужно обновить второе поле. Но когда я отправляю URL-адрес с параметрами, второе поле не обновляется.
Это мой код:
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputid">Identificador de viaje</label>
<input type="text" class="form-control" id="inputid" required>
<div class="invalid-feedback">
No ha ingresado los datos o el viaje señalado ya se encuentra cerrado.
</div>
</div>
<div class="form-group col-md-6">
<label for="estado">Estado</label>
<input type="text" class="form-control" id="estado" required disabled>
<div class="invalid-feedback">
No ha ingresado los datos o estos no son válidos.
</div>
</div>
</div>
<script>
var arrayOfValues;
function afterButtonClicked(){
if(validate()){
var cuenta = document.getElementById("cuenta");
var inputid = document.getElementById("inputid");
var estado = document.getElementById("estado");
var kmfinal = document.getElementById("kmfinal");
var rowDataarrive = {cuenta: cuenta.value,inputid:inputid.value,
estado: estado.value,kmfinal:kmfinal.value,
};
google.script.run.addNewRowarrive(rowDataarrive);
$('#modal').modal('hide')
$('#successnotification').toast('show')
setTimeout(function(){location.reload()}, 6000);
} else{
$('#modal').modal('hide')
$('#errornotification').toast('show')
}
}
function validate(){
var fieldsToValidate = document.querySelectorAll("#userform input, #userform select");
Array.prototype.forEach.call(fieldsToValidate, function(el){
if(el.checkValidity()){
el.classList.remove("is-invalid");
}else{
el.classList.add("is-invalid");
}
});
return Array.prototype.every.call(fieldsToValidate, function(el){
return el.checkValidity();
});
}
function getId(){
var idCode = document.getElementById("inputid").value;
google.script.run.withSuccessHandler(updateIdcode).getId(idCode);
}
function updateIdcode(estadolist){
document.getElementById("estado").value = estadolist;
}
google.script.url.getLocation(function(location) {
document.getElementById("inputid").value = location.parameters.inputid[0];
});
document.getElementById("inputid").addEventListener("input",getId);
document.getElementById("enviar").addEventListener("click",afterButtonClicked);
document.getElementById("loading").remove();
</script>
Затем, когда я отправляю URL-адрес с параметрами в свой навигатор , поле ввода "estado" не обновляется.
В чем моя проблема?