Adrian Crum (JIRA) wrote:
Also, a UI pattern I have been using lately is to have the current data select the correct list element, instead of displaying it twice. Example: <select name="allowSolicitation"> <#assign allowSolicitation = (mechMap.partyContactMech.allowSolicitation)?default("N")> <option value="Y"<#if allowSolitation == "Y"> selected="selected"</#if>>${uiLabelMap.CommonY}</option> <option value="N"<#if allowSolitation == "N"> selected="selected"</#if>>${uiLabelMap.CommonN}</option> </select> Not that this approach is any better, it's just different.
The main reason we have not used this approach in general is that it does not give as much information to the user. For simple applications it is fine and cleaner/smaller. For OFBiz we use the other pattern with the current values at the top and a separator that also default to the current value to err on the side of clarity and flexibility. The form widget supports both, BTW, and easily switches between them. The current value at the top has these benefits: 1. clarity: if another value is selected the user can still click on the drop-down and look at the top to see what the original value was 2. flexibility: if the current value is not part of the new options then we can't just select the one in the drop-down; this happens currently in various OFBiz screens, especially for status drop-downs that show the current status and all of the possible status transitions (usually there isn't a transition to go from one status back to itself) -David