[ 
http://www.stripesframework.org/jira/browse/STS-257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11214#action_11214
 ] 

Tim Fennell commented on STS-257:
---------------------------------

I think that what is does now is fine.  If you have to fill out a row, and you 
don't, then really that's more of a global error than a single field error 
right?  But still, give the EL function you just added couldn't a user also do 
exactly this quite concisely?  E.g.

<c:forEach ..../>
    ${s:hasErrors(actionBean, 'someList[index] ? '<span class="error">' : ''}
        <s:text .../>
        <s:text .../>
    ${s:hasErrors(actionBean, 'someList[index] ? '</span>' : ''}
<c:forEach ..../>

Not the most ideal I'll grant, but it should work and it would let the user 
decide what/when to highlight instead of deciding algorithmically which might 
well fall down in other cases.

Lastly, if we were to try and do something algorithmically I'd vote for pushing 
the "is this field in error" check into the TagErrorRendererFactory instead of 
being in the tag itself.  That way the factory can decide if it considers the 
field in error and return a renderer or not as appropriate.  Then the user can 
actually override the behaviour too.

> 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

Reply via email to