• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1583
  • Last Modified:

Horizontal Scroll bar for a ListBox

HI Experts,

I need to add a Horizontal Scrollbar for a List box in the JSP page which I have. I am using the <select> tag for creating a listbox. Could anyone of U please help me out in getting a horizontal scroll bar for this list box?

Irfyy
0
Irfyy
Asked:
Irfyy
  • 13
  • 9
  • 4
2 Solutions
 
TimYatesCommented:
You can't I don't think...

The only thing you could do, is put your list on another JSP, and load it as an IFRAME in the first JSP

http://www.htmlhelp.com/reference/html40/special/iframe.html

Or write it as a java applet (or flash or activex or something)
0
 
jarasaCommented:
Send this question to the HTML Area but I'm not really sure you can maybe with an style.

Javier
0
 
IrfyyAuthor Commented:
Could anyone please help me in achieving this?

Irfyy
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
TimYatesCommented:
Have you looked into doing it as an IFrame?
0
 
TimYatesCommented:
Try:

<select style='overflow:auto;'>

But that will not work on IE, only mozilla...
0
 
IrfyyAuthor Commented:
I tried this <select style='overflow:auto;'>... Not working...
0
 
IrfyyAuthor Commented:
I didnt get the IFrame concept... Would be great if U explain giving an example
0
 
TimYatesCommented:
0
 
IrfyyAuthor Commented:
This wont help my code as I use the selected listbox items to fetch some data from the database...

Any other solution?
0
 
TimYatesCommented:
Make the things that go into the list shorter...

ie:  after 10 characters length, add "..." to the end, etc...
0
 
IrfyyAuthor Commented:
I cant do that... My client wants the entire string to be put in the list box.
0
 
TimYatesCommented:
Hmmmmm....

Can't be done then (with HTML) :-(

What I would do, is put the shortened string in the listbox, and add an "onChange" javascript event that puts the full text into a div when the selection changes...
0
 
TimYatesCommented:
as jarasa said, maybe you'd get a better response over on the HTML TA

http://www.experts-exchange.com/Web/Web_Languages/HTML/ 

But I think they will say the same thing...
0
 
jarasaCommented:
But you want it to be a dropdown?
How long is your text?
Javier
0
 
IrfyyAuthor Commented:
No I dont want it to be a drop down.. Beacuse the users might need to multi select from the list box which cannot be achieved using a dropdown!

The text size varies.... Cant fix it... :-)
0
 
TimYatesCommented:
Can't do anything then...  You're going to have to talk to the client about a compromise, as they can't have what they want...  HTML doesn't work that way... :-(
0
 
IrfyyAuthor Commented:
Oopsss....

ok.. any way I can give a Tool Tip for the selected text?
0
 
TimYatesCommented:
You could try:

<select id="list" name="list">
  <option title="Your really long text goes here" value="1">Your really lo...</option>
  <option title="And this is another really long bit of text for the tooltip" value="2">And this is ano...</option>
</select>
0
 
TimYatesCommented:
But again, that may not work in IE

:-(
0
 
IrfyyAuthor Commented:
NOt wroking...
0
 
TimYatesCommented:
you using IE yeah?
0
 
IrfyyAuthor Commented:
Yes... Any other way to include a Tool Tip?
0
 
TimYatesCommented:
Not for IE...

Although this might work:

http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm

you'd have to try it out though (with select), he only shows links and divs working...

Tim
0
 
jarasaCommented:
Well Tim actually there is a way you can simulate a multiselect listbox with horizontal and vertical bars.

but is a bit complex.

You have to fill up a <table> inside a fixed size <DIV> the scrolls will appear as needed and you can put the values inside hidden <Inputs> the on the <TR onClick> you can chenge the <TR bgcolor> and keep it checked with a checkBox

hmm I'm not sure if I've explained well, if you want to give it a try I'll post you some code.

Javier
0
 
TimYatesCommented:
Ahhhh... of course...  but you then have to maintain the list of selected items, and what happens when the form is submitted?  

Oh hang on, I see...checkboxes :-)

Cool workaround :-)
0
 
jarasaCommented:
;c)

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 13
  • 9
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now