3 drop down list

Reply

Join Date: Sep 2008
Posts: 21
Reputation: dreamer14 is an unknown quantity at this point 
Solved Threads: 1
dreamer14 dreamer14 is offline Offline
Newbie Poster

3 drop down list

 
0
  #1
Jan 19th, 2009
Any one got hints how to do this?
I got 3 drop down list initally all 3 contains 4 option A,B,C,D.
After selecting A from 1stdrop down list,the 2nd and 3rd drop down list are left with B,C,D.
After selecting C form 2nd drop down list,the 3rd drop down list is left with B and D.
Any help/hints would be appreciated.
Thanks
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 21
Reputation: dreamer14 is an unknown quantity at this point 
Solved Threads: 1
dreamer14 dreamer14 is offline Offline
Newbie Poster

Re: 3 drop down list

 
0
  #2
Jan 19th, 2009
  1. <script language="javascript">
  2.  
  3. function mul1()
  4. {
  5. String a = document.getElementById("one").value;
  6. // document.getElementById("second").setAttribute("value",a);
  7. <% String sql22 = "Select * from test where two!='"+a+"'";
  8. Statement stmt22=con.createStatement();
  9. ResultSet rs22= stmt22.executeQuery(sql22);
  10. out.print("<select name=\"two\" id=\"two\" onChange=\"mul2();\">");
  11. while (rs22.next())
  12. {
  13. String qwe=rs22.getString("two");
  14. out.print("<option value="+qwe+">"+qwe+"</option>");
  15. }
  16. out.print("</select>");
  17. %>
  18. }
  19. </script>
  20. <body>
  21. <%
  22. String sql2 = "Select * from test";
  23. Statement stmt2=con.createStatement();
  24. ResultSet rs2= stmt2.executeQuery(sql2);
  25. out.print("<select name=\"one\" id=\"one\" onChange=\"mul1();\">");
  26. while (rs2.next())
  27. {
  28. String qwe=rs2.getString("two");
  29. out.print("<option value="+qwe+">"+qwe+"</option>");
  30. }
  31. out.print("</select>");
  32. %>
THis is what i have tried so far doesnt work
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1
Reputation: Diseirra is an unknown quantity at this point 
Solved Threads: 0
Diseirra Diseirra is offline Offline
Newbie Poster

Re: 3 drop down list

 
0
  #3
Jan 19th, 2009
I would do something like
  1. function onAclick()
  2. {
  3. var item=document.getElementById("A").value;
  4. document.getelementById("B").remove(item);
  5. document.getelementById("C").remove(item);
  6. document.getelementById("D").remove(item);
  7. }
And similar in other dropdowns
Diseirra
Last edited by peter_budo; Jan 19th, 2009 at 6:30 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 21
Reputation: dreamer14 is an unknown quantity at this point 
Solved Threads: 1
dreamer14 dreamer14 is offline Offline
Newbie Poster

Re: 3 drop down list

 
0
  #4
Jan 19th, 2009
  1. %@page import="java.util.*"%>
  2. <%@page import="java.lang.*"%>
  3. <%@page import="java.sql.*"%>
  4. <%@page import="java.text.*"%>
  5. <%@page import="java.util.Date"%>
  6. <%@include file="DBConnect.jsp"%>
  7. <%@page import="java.util.Date"%>
  8. <html>
  9. <head>
  10. <title>Untitled Document</title>
  11. </head>
  12. <script language="javascript">
  13. function mul()
  14. {
  15. var B=document.getElementById("one").value;
  16.  
  17. document.getelementById("tree").remove(B);
  18. //document.getelementById("C").remove(B);
  19. //document.getelementById("D").remove(B);
  20. }
  21. </script>
  22. <body>
  23. <%
  24. String sql2 = "Select * from test";
  25. Statement stmt2=con.createStatement();
  26. ResultSet rs2= stmt2.executeQuery(sql2);
  27. out.print("<select name=\"one\" id=\"one\" onChange=\"mul();\">");
  28. while (rs2.next())
  29. {
  30. String qwe=rs2.getString("two");
  31. out.print("<option value="+qwe+">"+qwe+"</option>");
  32. }
  33. out.print("</select>");
  34.  
  35. String sql21 = "Select * from test";
  36. Statement stmt21=con.createStatement();
  37. ResultSet rs21= stmt21.executeQuery(sql21);
  38. out.print("<select name=\"one1\" id=\"tree\">");
  39. while (rs21.next())
  40. {
  41. String qwe=rs21.getString("two");
  42. out.print("<option value="+qwe+">"+qwe+"</option>");
  43. }
  44. out.print("</select>");
  45. %>
  46. </body>
  47. </html>
I get a error message that say Object doesnt support this property or method
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for JSP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC