[
http://www.stripesframework.org/jira/browse/STS-257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11213#action_11213
]
Ben Gunter commented on STS-257:
--------------------------------
I've just been working on this, and I've found that given property names like
foo[0], foo[1], ... if an error occurs for any one of the fields (type
conversion or something) then the CSS class does get set like it's supposed to
for each field in error. But if the error is on the list itself -- like a
custom validation that prevents the list from being empty -- then the CSS class
does not get set because InputTagSupport looks for the errors under the exact
name of the field, not the stripped name. Tim, you probably already knew that,
but now it's documented a little bit more clearly (IMHO).
I almost committed a change so that if no validation errors are found under
list[0] then it will strip the param name and look under list as well. It
worked, but then I realized that given something more complex like
foo[0].bar[0] that probably wouldn't work because the actual name of the list
would be foo[0].bar, whereas the stripped param name would be foo.bar.
This could be done by stripping just the last index and trying, and repeating
that until one is found or you run out of indexes. We need to decide if it's
worth it to achieve what we're trying to achieve here. Tim, please comment.
> Tags (particularly label) do not look up correct localized field name when
> the name includes indexing
> -----------------------------------------------------------------------------------------------------
>
> Key: STS-257
> URL: http://www.stripesframework.org/jira/browse/STS-257
> Project: Stripes
> Issue Type: Bug
> Components: Tag Library
> Affects Versions: Release 1.4
> Reporter: Tim Fennell
> Fix For: Release 1.5
>
>
> I've been looking into this and I think it's actually a bug/lack of support
> for indexed property names in the way tags lookup the localized field names.
> The "correct" way to use the label tag should be like this:
> <s:label name="choices[${num-1 }].short_text" for="text${num-1}"/>
> <s:text name="choices[${num-1 }].short_text" id="text${num-1}"/>
> I.e. the for attribute on the label matches the 'id' attribute on the text
> tag. But if you set it up this way then you should get the error rendering
> correctly, but the localized label won't get looked up correctly (it really
> needs to removing the indexing and look up the label with
> 'choices.short_text').
> I'll log a bug for this.
> -t
> On Aug 29, 2006, at 5:57 AM, Andrea Bondi wrote:
> Ok, I managed to get the label localized from StripesResources file.
> But it seems that it isn't tied with the text field: even if there's an
> error in that field, the label class isn't changed int class="error" and
> only the field change class.
> Code is:
> <stripes:label name="short_text" for="choices[${num-1 }].short_text" />
> <stripes:text style="width:50px;"
> name="choices[${num-1 }].short_text" />
> And in the rendered page, after an error:
> <label for="choices[0].short_text">Risposta Corta</label>
> <input value="" type="text" class="error" style="width:50px;"
> name="choices[0].short_text" />
> Thank you for your very useful help but, aboveall, for stripes ;)!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development