• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dropdown list not displaying with textfield in form

 
Kenneth Owino
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I've written a JSP that has a form and the form contains a dropdown list and a texfield. The dropdown is populated from a mysql database using beans which act as DAOs and DTOs. Problem is the dropdown doesn't display the values from the database but when I remove the textfield from the form and leave only the dropdown, it displays fine. someone knows why? Please let me know what to do. The code for the forms is below:

Form without textfield:


Form with textfield
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There were a whole lot more changes besides that one. For example here's your non-working version:

and here's your working version:
 
Kenneth Owino
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for noticing that. But that was a minor change I did when trying to troubleshoot. It actually changes nothing. In fact the change made was just removing the
from "Form with texfield" and the dropdown could then display the elements. the question actually is why does it only display without textfield and how can i make it display with textfield?
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And in the working version you wrapped a label element around the select element... there's probably a dozen differences that I could point to. Given that, I don't think that picking one of those dozen is a good strategy. When you're trouble-shooting, just change one thing at a time.
 
Kenneth Owino
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Honestly I don't see what you are looking at. I expect you to see something more than what you are looking at. Thank you
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really?

First version:


Second version:


I'm just taking these things from the code you posted.

The idea that adding a textfield above an element would cause that element to disappear isn't very credible compared to other more ordinary explanations. That's why I'm basically ignoring that idea and looking for the ordinary explanations.
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a reason the id for the campuses select element changed from camps to hostel or that the select element shares the same id as the textfield? Shouldn't the label element be used before an input element instead of encapsulating it?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike Zal wrote:Shouldn't the label element be used before an input element instead of encapsulating it?

No, that is perfectly valid HTML and associates the label with the element without the need for the for attribute.
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Mike Zal wrote:Shouldn't the label element be used before an input element instead of encapsulating it?

No, that is perfectly valid HTML and associates the label with the element without the need for the for attribute.


Thanks for the clarification. I never used it before and all the examples I looked at briefly showed it being used before the input element.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!