• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dropdown filter

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to use >3 dropdown menus as a filter in one frame submitting with onchange - two problems :
on the second dropdown-onchange doesn't work;
the first dropdown doesn't keep the selection;
my experience is fiew and exhausting - please help !!

[ October 31, 2002: Message edited by: Werner Hirschlinger ]
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Code Seeker
Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The first problem (the second onChange doesn't work) might be to do with the fact that your javascript submits compartment but the form is called Compartment (I don't know if DOM is case sensitive).
The second problem is just that you have to add the "selected" attribute to the option that you wish to select e.g.
<select name="selbrh" onchange="subbrh()">
<%
//get the previously selected value
String selbrhVal = request.getParameter("selbrh");
if(selbrhVal == null) selbrhVal = "";
DriverManager.registerDriver
(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection
("jdbc racle:thin:@alois:1521 emrep2",
"repos_manager", "admin"
);
Statement stmt1 = con.createStatement();
ResultSet rs1 = stmt1.executeQuery
("select distinct branch from branch");
%>
<% while (rs1.next()) {
String dbVal = rs1.getString(1);
String selected = "";
if(selbrhVal.equals(dbVal)) selected="selected";
%>
<option value="<%=dbVal%>" <%=selected%>>
<%=rs1.getString(1) %>
</option>
<% } %>
Hope that helps
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
@Cindy : still beating, but far from taking off !
@Jesse :
thanks a lot for your worthy tips � I changed �Compartment�, but it didn�t work either � obscure is, that (the single) onchange works properly with 2 forms (sending the first selection to the second form), but when I add a third form, onchange of second form can�t send the selection to form 3 or the request.getParameter(selcot) Method of form 3 doesn�t receive the selection of form 2 (see first post).
I tried to save the selection in a variable and send it to form 2 (or 3) with no effect (see below).
The hint to the �selected� attribute is good � still working on that� (maybe i can use selectedIndex)
- I would be very grateful if somebody has more ideas

[ October 31, 2002: Message edited by: Werner Hirschlinger ]
[ October 31, 2002: Message edited by: Werner Hirschlinger ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it's me one more time (fishing in mud)
- concerning to Topic: JSP / "Do I need to use ! for declarations" :
is it necessary to dis-/able a Single Thread because of succsessing "request" methods in each form ?
excuse my poorness in mind
reply
    Bookmark Topic Watch Topic
  • New Topic