<stripes:option> 'selected' Attribute Should (For Consistency Sake) Accept 
Boolean Values
-----------------------------------------------------------------------------------------

                 Key: STS-898
                 URL: http://www.stripesframework.org/jira/browse/STS-898
             Project: Stripes
          Issue Type: Improvement
          Components: Tag Library
    Affects Versions: Release 1.5.7
            Reporter: Dan Nelson
            Priority: Minor


We've made sure that {{<stripes:text>}}, {{<stripes:textarea>}}, 
{{<stripes:select>}} elements accept boolean-like values for attributes like:
* _readonly_
* _disabled_
* _multiple_
...This allows us to embed EL expressions into the afore mentioned attributes 
that in turn yield the appropriate html markup.  We seem to have forgotten to 
apply this behaviour to the {{<stripes:option>}} element.  In the following 
snippet, my {{ActionBeanContext}} has a {{getUserDateTimeZone()}} read method, 
that returns a {{org.joda.time.DateTimeZone}} instance representing the current 
request's timezone.  Let's pretend this requests timezone is set to 
_America/Vancouver_, the following code:
{code:title=JSP markup...}
...
<stripes:select name="dateTimeZoneId">
  <stripes:option value="America/Vancouver" 
selected="${requestScope.actionBean.context.userDateTimeZone.ID}">America/Vancouver</stripes:option>
  <stripes:option value="America/Edmonton" 
selected="${requestScope.actionBean.context.userDateTimeZone.ID}">America/Edmonton</stripes:option>
  <stripes:option value="America/Regina" 
selected="${requestScope.actionBean.context.userDateTimeZone.ID}">America/Regina</stripes:option>
</stripes:select>
...
{code}
...will produce a select box whose options are all in a selected state (the 
last one, _America/Regina_ being displayed as the selected option):
{code:title=Actual html...}
...
<select name="dateTimeZoneId">
  <option value="America/Vancouver" 
selected="selected">America/Vancouver</option>
  <option value="America/Edmonton" selected="selected">America/Edmonton</option>
  <option value="America/Regina" selected="selected">America/Regina</option>
</select>
...
{code}

It is my opinion that the {{<stripes:option>}} element's _selected_ attribute 
should behave more like the {{<stripes:text>}} element's _readonly_ attribute, 
whereby it accepts boolean-like expressions and in accordance produces the 
correct html markup for the supplied condition value.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to