jsp - How To Wrap Text in HTML Dropdown List -
possible duplicate:
word wrap options in select list
is possible wrap long text within html <option>
box?
in jsp, have section of code pulls values database within loop , appends them <option>
section of <select>
list.
below portion of code referencing:
<select name='codes' onchange="showstate(this.value)"> <option value="none">select code</option> <% //pulls ids , descriptions codes table , stores them in first drop down try { class.forname("oracle.jdbc.driver.oracledriver").newinstance(); connection con = drivermanager.getconnection("url","username","password"); statement stmt = con.createstatement(); resultset rs = stmt.executequery("select id, descr ref_codes"); while(rs.next()) { %> <option value="<%=rs.getstring(1)%>"><%=rs.getstring(1)%> <%=rs.getstring(2)%></option> <% } //closes database connection stmt.close(); con.close(); } catch (classnotfoundexception e) { system.err.println("classnotfoundexception: " + e.getmessage()); } catch (sqlexception e) { system.err.println("sqlexception: " + e.getmessage()); } catch (exception e) { system.err.println("generic exception: " + e.getmessage()); } %> </select>
my problem of pulled values way long , stretch drop down box further length of page, stays on same line. whenever encounter long string, want make wrap next line, still included part of same <option>
value.
i've looked around on google , got varying answers. people can done, others cannot.
however, of answers seems outdated (from around mid 2000s) , ones have tried, involving use of <div>
tag, have had no luck with. meaning options still remain on 1 line regardless of how long , don't wrap next line, despite me specifying width
of <div>
tag.
so has done in html before or know if it's possible?
couldn't pull max # of characters want drop-down, re-select same field but start @ next character, grabbing same # of characters, etc. use html/css formatting combine , make them want.
Comments
Post a Comment