943,733 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Unsolved
  • Views: 4650
  • JSP RSS
Jan 19th, 2009
0

3 drop down list

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
dreamer14 is offline Offline
31 posts
since Sep 2008
Jan 19th, 2009
0

Re: 3 drop down list

JSP Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 1
Light Poster
dreamer14 is offline Offline
31 posts
since Sep 2008
Jan 19th, 2009
0

Re: 3 drop down list

I would do something like
JavaScript Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Diseirra is offline Offline
1 posts
since Jan 2009
Jan 19th, 2009
0

Re: 3 drop down list

JSP Syntax (Toggle Plain Text)
  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
Reputation Points: 10
Solved Threads: 1
Light Poster
dreamer14 is offline Offline
31 posts
since Sep 2008
Mar 17th, 2011
0
Re: 3 drop down list
i have this type of code like
User:<select>
<option>Faculty</option>
<option>Student</option>
</select>
now what i want when i am selected Faculty option then page will be redirect to Faculty.jsp page is it possible in jsp ...plz reply me ...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
erdhaval is offline Offline
1 posts
since Mar 2011
Mar 17th, 2011
0
Re: 3 drop down list
Click to Expand / Collapse  Quote originally posted by erdhaval ...
i have this type of code like
User:<select>
<option>Faculty</option>
<option>Student</option>
</select>
now what i want when i am selected Faculty option then page will be redirect to Faculty.jsp page is it possible in jsp ...plz reply me ...
Start a new thread and read about onclick events:
JSP Syntax (Toggle Plain Text)
  1. <select onchange="">
  2. ..
  3. </select>
or
JSP Syntax (Toggle Plain Text)
  1. <select onclick="">
  2. ..
  3. </select>

http://www.w3schools.com/default.asp
Sponsor
Featured Poster
Reputation Points: 1014
Solved Threads: 446
Nearly a Senior Poster
javaAddict is offline Offline
3,258 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: JSP: Determining username
Next Thread in JSP Forum Timeline: Image Upload with text fiedd





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC