Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hello, I have a problem with dro

Status
Not open for further replies.

sweng

Programmer
Jun 2, 2003
10
IN
hello,

I have a problem with dropdown list refreshing.
The code is pasted below:

<HTML>
<body >


<%@ page import=&quot;java.lang.*&quot; %>
<%@ page import=&quot;java.sql.* &quot; %>
<%@ page import=&quot;java.util.*&quot; %>

<jsp:useBean id=&quot;Lib&quot; class=&quot;Lib.cddatabase&quot;>
<jsp:setProperty name=&quot;Lib&quot; property=&quot;*&quot;/>
</jsp:useBean>
<script language=&quot;javascript&quot;>



function locfun()
{
cdform.location.value = cdform.combo2.value;
}

function new1_click()
{
cdform.source.value = &quot; &quot;;
}

function new2_click()
{
cdform.location.value = &quot; &quot;;
}

function new3_click()
{
cdform.status.value = &quot; &quot;;
}

function new4_click()
{
cdform.vendorid.value = &quot; &quot;;
}

function statfun()
{
cdform.status.value = cdform.combo3.value;
}

function venfun()
{
cdform.vendorid.value = cdform.combo4.value;
}

function sourcefun()
{
cdform.source.value = cdform.combo1.value;
}



</script>
<%! String flag; %>
<% Lib.connect(); %>
<br>
<% Lib.select(); %>


<%@ page import=&quot;java.util.Vector&quot; %>
<% Vector avendorid = Lib.getvendorid(); %>
<% Vector avendorname = Lib.getvendorname(); %>
<% Vector asourceid = Lib.getsourceid(); %>
<% Vector asourcename = Lib.getsourcename(); %>
<% Vector alocationid = Lib.getlocationid(); %>
<% Vector alocationname = Lib.getlocationname(); %>
<% Vector astatusid = Lib.getstatusid(); %>
<% Vector astatusname = Lib.getstatusname(); %>
<% Vector acdkey = Lib.getcdkey(); %>
<table align =center>
<tr> <td> <%@ include file=&quot;../../images/head.html&quot; %> </td> </tr>

</table>
<br><br>
<TABLE bgcolor = &quot;#fcf7ec&quot; border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 50 >

<TR>
<TD ALIGN = CENTER>

</TD>
<TD ALIGN = CENTER>

</TD>
<TD ALIGN = CENTER>

</TD>
</TR>

</TABLE>

<%! String title,purdate,keywords,sourceid,price,loc,status,vendorid; %>



<form name = &quot;cdform&quot; method = &quot;post&quot; action=&quot;VIEWDET.jsp&quot;>
<TABLE bgcolor = &quot;#fcf7ec&quot; border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 325 >


<tr> <td> &nbsp; </td> </tr>

<TR>
<TD ><!--ADD ANOTHER TABLE-->

<TABLE border = 0 bgcolor = &quot;#eee0c5&quot; bordercolor = &quot;#eee0c5&quot; cellpadding = 0 cellspacing = 0 align = center width = 300 height = 200 >
<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>CDKEY</FONT></LABEL>
</TD>
<TD >

<select name = &quot;combo1&quot; onchange = &quot;<% Lib.setcdkey(request.getParameter(&quot;combo1&quot;)); %> cdform.submit(); &quot; VALUE = <% request.getParameter(&quot;combo1&quot;);%> >

<%
for (int i=0; i < acdkey.size(); i++) { %>
<option value=&quot;<%=acdkey.elementAt(i)%>&quot;><%=acdkey.elementAt(i)%></option>
<% } %>

</select>

</TD>

</TR>

<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>TITLE</FONT></LABEL>
</TD>
<TD >
<INPUT type=&quot;text&quot; name=&quot;title&quot;>
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>SOURCE</FONT></LABEL>
</TD>
<TD >
<INPUT type=&quot;text&quot; name=&quot;source&quot; value = &quot;<%=Lib.test() %>&quot; >

</TD>
</TR>

<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>PRICE</FONT></LABEL>
</TD>
<TD >
<INPUT type=&quot;text&quot; name=&quot;price&quot;>
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>PURCHASE DATE</FONT></LABEL>
</TD>
<TD >
<INPUT type=&quot;text&quot; name=&quot;purchasedate&quot;>
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>LOCATION</FONT></LABEL>
</TD>
<TD >

<INPUT type=&quot;text&quot; name=&quot;location&quot; >

</TD>
</TR>

<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>STATUS</FONT></LABEL>
</TD>
<TD >
<INPUT type=&quot;text&quot; name=&quot;status&quot;>

</TD>
</TR>

<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>KEYWORDS</FONT></LABEL>
</TD>
<TD >
<INPUT type=&quot;text&quot; name=&quot;keyword&quot;>
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1 color = &quot;#eee0c5&quot;>&nbsp;</FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = &quot;Verdana&quot; size = 1>VENDOR ID</FONT></LABEL>
</TD>
<TD >
<INPUT type=&quot;text&quot; name=&quot;vendorid&quot; >

</TD>
</TR>

</TABLE>

<TABLE bgcolor = &quot;#eee0c5&quot; border = 0 cellpadding = 0 cellspacing = 0 align = center width = 300 height = 1 >
<TR>
<TD >
<FONT COLOR = &quot;#eee0c5&quot;>&nbsp;</FONT>
</TD>
</TR>
</TABLE>

</TD>
</TR>
<TR>
<TD>
<TABLE bgcolor = &quot;#fcf7ec&quot; border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 1 >
<TR>
<TD >
<TABLE border = 0 bgcolor = &quot;#eee0c5&quot; bordercolor = &quot;#eee0c5&quot; cellpadding = 0 cellspacing = 0 align = center width = 300 height = 40 >
<TR>
<TD ALIGN=CENTER>
<!-- BUTTON HERE-->
<input name=&quot;button&quot; type=&quot;submit&quot; value=&quot;PREV&quot; style=&quot;WIDTH: 99px; HEIGHT: 22px; BACKGROUND-COLOR: tan&quot; size =&quot;33&quot;>
</TD>
<TD ALIGN=CENTER>
<!-- BUTTON HERE-->
<input name=&quot;button&quot; type=&quot;submit&quot; value=&quot;NEXT&quot; style=&quot;WIDTH: 99px; HEIGHT: 22px; BACKGROUND-COLOR: tan&quot; size =&quot;33&quot;>
</TD>

</TR>

</TABLE>
</TD>
</TR>
</TABLE>

</TD>
</tr>
<tr> <td> &nbsp; </td> </tr>

<TR> <td> <%@ include file=&quot;../../images/footer.html&quot; %> </TD> </TR>
</TABLE>


</form>

</body>
</html>

The problem is that as I change the value of dropdown list , combo1 the changes get reflected to the text box source .. but since the page is getting reloaded, the combo box gets refreshed and I lose the selected value..

I have a bean which gets the value from the database and returns an array.

I need the combo box to retain its previous value..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top