Forum Moderators: not2easy

Message Too Old, No Replies

word wrap possible in dynamically created <option> listing

option word wrap

         

mmmilligan

10:18 pm on Aug 22, 2003 (gmt 0)

10+ Year Member



I've got some loooong <select> options coming onto a form dynamically from a clients database. I wish there was a way to wrap the option. As it is, I can use style to set width: 45ex but that only cuts off the last part of the option. I tried word-wrap: break-word but that seemed to have no effect.

Any suggestions?

Thanks,
Mike Milligan

BlobFisk

4:05 pm on Aug 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, mmmilligan!

The only way that I've seen this done is by manually coding the lines into seperate <option>'s. Not nice!

You should think about trying to convey this information in a manner other than a select list. If the lines are so long that you need to consider wrapping them, then I'd be inclined to try something other than a select list!

mmmilligan

4:27 pm on Aug 23, 2003 (gmt 0)

10+ Year Member



I agree that it's not nice but I suspect I'll need to do it anyway. I'm stuck with the dropdown format. My PHP already writes a 2000 line chunk of javascript switch-case statements that populate the option text and value list. Guess it's gonna get bigger.

Thanks for your comments,
Mike

MonkeeSage

4:48 pm on Aug 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could make an 'info' div and set it's innerHTML onmouseover on an option in the select box and clear it onmousout, but that only works in Mozilla...IE doesn't capture mouse events in select boxes except clicks, it seems. Not sure how you could fix it.

Jordan

mmmilligan

5:33 pm on Aug 23, 2003 (gmt 0)

10+ Year Member



Oh, were it that IE only had CSS word-wrap styles for option elements! But then, if wishes were horses beggars would ride.

Thanks, Jordan.

Mike