Hi guys,
sorry, but i don't have ride the mail; the code is:

1. put the values of the combobox father (ciudad) trought jsp and java
script. ok?
the code is:
<select name="ciudad" onChange="actualizarlugar()">
          <option value="0" selected>Seleccione una ciudad</option>
          <%conp.consultarciudad();
                        while (conp.ciudadsiguiente())
                        {
                        %>
          <option value="<%=conp.idciudad%>"><%=conp.ciudad%></option>
          <%
                        }%>
        </select>
.
.
.
 conp.consultarciudad(), this method return all the cities.
 conp.ciudadsiguiente(), return true if the "resulset" contain more
 records.

2.actualiza lugar(), is a function on Javascript that put the values
related with the father (ciudad).

<script language="JavaScript">

function actualizarlugar()
{
var vciudad= new Array();
var vlugar= new Array();
var vcodigo= new Array();
//this arrays conain all places and the code of the cities related with
//the places.
<%int i=1;
conp.consultarlugar1();
while (conp.lugarsiguiente())
{%>
vcodigo[<%=i%>]=<%=conp.idlugar%>;
vlugar[<%=i%>]="<%=conp.lugar%>";
vciudad[<%=i%>]=<%=conp.idciudad%>;
<%
i = i +1;}
i= i-1;
%>
enviaevento.lugar.value=0; //put 0 in the defaultvalue of the combobox
//lugar(place), enviaevento is a form.

for(var i = enviaevento.lugar.length - 1; i >= 1; i--)
{
                if(navigator.appName == "Netscape") {
                        enviaevento.lugar.options[i] = null;
                }
                else {
                        enviaevento.lugar.remove(i);
                }
}

var k = 0;


for (var i = 1 ; i <= <%=i%>; i++){

        if (vciudad[i]== enviaevento.ciudad.value){
        k++;
        enviaevento.lugar.options[k] = new Option(vlugar[i],vcodigo[i]);
        }

}

}
</script>
.
.
.
 conp.consultarlugar1(), this method return all the places.
 conp.lugarsiguiente(), return true if the "resulset" contain more
 records.



I hope this help you....:-)
I hope suggestions...:-)

Wilson Lozano
Bucaramanga-Colombia....beautiful Colombia

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to