• 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 list not displaying with textfield in form

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 144
Oracle Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Oracle Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic