• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

control the maximum length of text in a drop down list

 
Ananth Chellathurai
Ranch Hand
Posts: 349
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • 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 ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34870
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Shane W
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • 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
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. Thanks for all your valuable time.

Ananth
[ November 24, 2007: Message edited by: Ananth Chellathurai ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic