• 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

control the maximum length of text in a drop down list

 
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have drop down list which lists n number of products. When a product name is huge my drop down list gets long. Is there a way to restrict the max length of the text to be displayed, and display ... after the length.
Please advice me on this.

Ananth
[ November 22, 2007: Message edited by: Bear Bibeault ]
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ananth,
Do you want to restrict the length (have less than n elements in the list) or the width (have n elements but display less text for the long ones) ?

If length, you can put less entries in the list in Java. If width, you can use a CSS style to set the width of the pull down to an explicit number or pixels. Alternatively for width, you can loop through in Java, and get rid of some of the characters.

These are both technical solutions. A "better" solution would be to edit the source data to make it shorter or make a "display name" equivalent that is shorter. Sometimes chopping off data doesn't yield the best results unless a human does it.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,If its the width you want to restrict,you can use a a CSS or otherwise (as stated in the solution above)to restrict the width.Tool tip can be used so that user can see the full terxt if it is not completely visible

Shane
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it. Thanks for all your valuable time.

Ananth
[ November 24, 2007: Message edited by: Ananth Chellathurai ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic