//inicializacion autocompletes var autonomia_options = { script:"resultsautocomplete.do?field=autonomia&", varname:"input", json:true, noresults: "No Hay Resultados", timeout: 5000, callback: function (obj) { document.getElementById('autonomia_id').value = obj.id; document.getElementById('provincia').value = ''; document.getElementById('provincia_id').value = ''; document.getElementById('municipio').value = ''; document.getElementById('municipio_id').value = ''; document.getElementById('playa').value = ''; //document.getElementById('playa_id').value = ''; } }; var autonomia_json = new AutoSuggest('autonomia', autonomia_options); var provincia_options = { script: function (input) { return "resultsautocomplete.do?field=provincia&input=" + input + "&idautonomia=" + document.getElementById("autonomia_id").value; }, varname:"input", json:true, noresults: "No Hay Resultados", timeout: 5000, callback: function (obj) { document.getElementById('provincia_id').value = obj.id; document.getElementById('municipio').value = ''; document.getElementById('municipio_id').value = ''; document.getElementById('playa').value = ''; //document.getElementById('playa_id').value = ''; } }; var provincia_json = new AutoSuggest('provincia', provincia_options); var municipio_options = { script: function (input) { return "resultsautocomplete.do?field=municipio&input=" + input + "&idautonomia=" + document.getElementById("autonomia_id").value + "&idprovincia=" + document.getElementById("provincia_id").value; }, varname:"input", json:true, noresults: "No Hay Resultados", timeout: 5000, callback: function (obj) { document.getElementById('municipio_id').value = obj.id; document.getElementById('playa').value = ''; //document.getElementById('playa_id').value = ''; } }; var municipio_json = new AutoSuggest('municipio', municipio_options); /*var playa_options = { script: function (input) { return "resultsautocomplete.do?field=playa&input=" + input + "&idautonomia=" + document.getElementById("autonomia_id").value + "&idprovincia=" + document.getElementById("provincia_id").value + "&idmunicipio=" + document.getElementById("municipio_id").value;; }, varname:"input", json:true, noresults: "No Hay Resultados", timeout: 5000, callback: function (obj) { document.getElementById('playa_id').value = obj.id; } }; var playa_json = new AutoSuggest('playa', playa_options);*/ function limpiarCampo(obj, id) { if (obj.value == '' || document.getElementById(id).value == '') { obj.value = ''; document.getElementById(id).value=''; } } function validaText() { if (document.getElementById("autonomia_id").value!="" || document.getElementById("provincia_id").value!= "" || document.getElementById("municipio_id").value!= "" || (document.getElementById("playa").value!= "" && document.getElementById("playa").value.length>=3)) { document.getElementById("ConsultaInicioFormBean").submit(); } else { if (document.getElementById("playa").value!= "") alert("El nombre de la playa debe tener más de 3 caracteres."); else{ //alert("Debe elegir al menos un criterio para la búsqueda."); //cargar el store store.load(); win.show();//mostrar la ventana } } }