Project

General

Profile

« Previous | Next » 

Revision 8518

Added by Jing Tao almost 11 years ago

Add the code to set the stored value be selected in the option list.

View differences:

lib/admin/auth-configuration.jsp
95 95
		     				<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>	   	
96 96
							<select class="textinput" name="<%= metaDataProperty.getKey() %>">
97 97
		<%
98
		                    String storedValue = (String)request.getAttribute(metaDataProperty.getKey());
98 99
							Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
99 100
							Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
100 101
							for (int i = 0; i < fieldOptionNames.size(); i++) {
101
		%>
102
								<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
102
							     boolean foundStoredValue = false;
103
							     if(storedValue != null && !storedValue.equals("") && storedValue.equals(fieldOptionNames.elementAt(i))) {
104
							         foundStoredValue = true;
105
							     }
106
                             if(foundStoredValue) {
107
        %>
108
                                <option value="<%= fieldOptionValues.elementAt(i) %>" selected="selected"><%= fieldOptionNames.elementAt(i) %></option>
109
        <%
110
                              } else {
111
        %>
112
								<option value="<%= fieldOptionValues.elementAt(i) %>"><%= fieldOptionNames.elementAt(i) %></option>
103 113
		<%
114
		                      }
104 115
							}
105 116
		%>
117
		
106 118
							</select>
107 119
							<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
108 120
							

Also available in: Unified diff