How do I limit length of a dropdown menu?
I have a drop down menu that represents a field in my database table that is several hunfred characters long. How could I limit the size of the text box on my JSP page so that it doesn't represent the entire length of the string? Either cutting it off at a certain point and not being able to see the remainder of the string would be good or even better if when the string was selected, the user could scroll across a text box of size 30 across to see the entire string.
Please help and show some code if possible.
Thank you very much in advance for your assistance.
I am getting these values that populate my drop down from a column in the table of my database. The field in my database is 400 characters long.
How can I make sure that the drop down menu that appears on my JSP page is not more than 50 characters long. With allowing the user to scroll along within that text box of length 50 to see the entire 400 characters only when selected?
Please help?
Thank you.
This is the tag I am trying to limit the size of the drop down menu.
PLEASE HELP!!!!
<TR>
<TD ALIGN="right"><B><B><div class="text">Number:</div></B></TD>
<TD><SELECT type="select" name="Number">
<OPTION value=0> - Select Number - </OPTION>
<%
String[] NumberList = beanName.getList("NumberList");
if (NumberList != null)
{
for (int i=0; i < NumberList.length; i++)
{
if (NumberList.equals (strSelectedResource))
{
%>
<OPTION selected value="<%= NumberList %>"> <%= NumberList %> </OPTION>
<%
}
else
{
%>
<OPTION value="<%= NumberList %>"> <%= NumberList %> </OPTION>
<%
}
}
}
else
{
%>
<OPTION> No Numbers Loaded </OPTION>
<%
}
%>
</SELECT>
</TD>
</TR>
I guess you could cut the string off at 50 chars.
String option = .....; // from your ResultSet
.
.
option = option.substring(0, 50); // cuts it off at 50 chars.
%>
<option value="<%=option%>"><%=option%></option>
<%
.
.