• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

pre-select in option

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can one highlight the last pre-selection in a dynamic list? Thank you


<%
for( int i = 0 ; i < arraylist.size() ; i++ ) {
%>
<option value="<%= arraylist.get( i ).toString() %>"><%= arraylist.get( i ).toString() %></option>
<%
}
%>
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add selected to the option tag

Eric
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%
for( int i = 0 ; i < arraylist.size() ; i++ ) {
%>

<option value="<%= arraylist.get( i ).toString() %>"
<% // add the condition to check if this entry is the selected one%>
SELECTED = "SELECTED"
>
<%= arraylist.get( i ).toString() %>
</option>

<%
}
%>
 
Can you smell this for me? I think this tiny ad smells like blueberry pie!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic