54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
|
|
function rellenaSelect2Input(idSelect,idInput){
|
|||
|
|
var campoSelect = document.getElementById(idSelect);
|
|||
|
|
var campoInput = document.getElementById(idInput);
|
|||
|
|
|
|||
|
|
var valor = campoSelect.options[campoSelect.selectedIndex].innerHTML;
|
|||
|
|
campoInput.value=valor;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function rellenaSelect2InputLoc(idSelect,idInput,idSelect2){
|
|||
|
|
var campoSelect = document.getElementById(idSelect);
|
|||
|
|
var campoInput = document.getElementById(idInput);
|
|||
|
|
var campoSelect2 = document.getElementById(idSelect2);
|
|||
|
|
|
|||
|
|
var valor = campoSelect.options[campoSelect.selectedIndex].innerHTML;
|
|||
|
|
campoInput.value=valor;
|
|||
|
|
|
|||
|
|
// Averiguamos el optgroup
|
|||
|
|
var optgroup=campoSelect.options[campoSelect.selectedIndex].parentNode.label;
|
|||
|
|
for(i=0;i<campoSelect2.length;i++){
|
|||
|
|
if(campoSelect2.options[i].innerHTML==optgroup){
|
|||
|
|
campoSelect2.options[i].selected=true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function rellenaSelect2InputRecorte(idSelect,idInput,idInput2){
|
|||
|
|
var campoSelect = document.getElementById(idSelect);
|
|||
|
|
var campoInput = document.getElementById(idInput);
|
|||
|
|
var campoInput2 = document.getElementById(idInput2);
|
|||
|
|
|
|||
|
|
var valor = campoSelect.options[campoSelect.selectedIndex].innerHTML;
|
|||
|
|
var inicio = valor.lastIndexOf("(");
|
|||
|
|
var fin = valor.length;
|
|||
|
|
var abreviatura = valor.substring(inicio+1,fin-1);
|
|||
|
|
valor=valor.substring(0,inicio);
|
|||
|
|
|
|||
|
|
campoInput.value=valor;
|
|||
|
|
campoInput2.value=abreviatura;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function verificarEliminarOpcion(){
|
|||
|
|
var formulario=document.getElementById('formularioMantenimiento');
|
|||
|
|
var mensaje="\xbfEst\xe1 seguro que desea eliminar la opci<63>n?";
|
|||
|
|
if(confirm(mensaje)){
|
|||
|
|
var newInput = document.createElement("input");
|
|||
|
|
newInput.type="text";
|
|||
|
|
newInput.name="action";
|
|||
|
|
newInput.value="Eliminar";
|
|||
|
|
newInput.style.visibility="hidden";
|
|||
|
|
formulario.appendChild(newInput);
|
|||
|
|
formulario.submit();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|