It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

HTML select tag

HTML select tag

Postby racco on Sun Nov 20, 2005 12:04 am

Hello!

Do you know if there is any way to
cut very long <option> values short?

Maybe to present them in two lines or sth.

I have to do a form with <select> tag
and its <option> tags contain very long
phrases and it looks awfull.
There is no chance to cut them off to
the normal length, so I wonder whether
there is a way to let's say split the text
or sth.

Lookin forward to getting some support from you!!


racco
racco
 
Posts: 3
Joined: Sun Nov 20, 2005 12:03 am

Postby webmaster on Sun Nov 20, 2005 11:28 am

Hi and welcome to DEVPPL.

Without using and server language like PHP or ASP, maybe you can do like this:

Code: Select all
<select style="width:100px;">


I don't know if it can be done with javscript, but this is the way I would do it.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby racco on Sun Nov 20, 2005 3:03 pm

hello!

thx for your answer!

your solution works under FireFox but it seems to be useless with IE, because it reduces the width of selector box, but you cannot see the whole content of any long <option> row (under FF you see all when you are Over it)


what to do?


racco
racco
 
Posts: 3
Joined: Sun Nov 20, 2005 12:03 am

Postby webmaster on Sun Nov 20, 2005 11:24 pm

I don't know if there are any solutions for this in HTML and CSS. But do you have ASP or PHP installed on your server? If you have that, you can make some script that will cut of the sentence to like 70 characters and replace it bu three dots or something like that.

Do you know if you have PHP or ASP support on your server?
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden

Postby racco on Mon Nov 21, 2005 8:57 pm

I have PHP and it is not problem for me tu cut the length of a string, I rather wanted to know whether there is a way to present a very long option in select box reduced to some width (let's say on mouse over this option there would be sth similar to alt or title over image displayed)

but anyway, I managed to change the length by reducing and paraphrasing some words from those options, so now it is ok


thx
racco
racco
 
Posts: 3
Joined: Sun Nov 20, 2005 12:03 am

Postby webmaster on Mon Nov 21, 2005 9:42 pm

Ok, good that you could solve it. There might be some solution for it in JavaScirpt, so if you want to add thoose extra words again, check if there're some javascript solution for it.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2695
Joined: Tue Aug 17, 2004 1:07 pm
Location: Sweden


Who is online

Users browsing this forum: No registered users and 3 guests