Hi Rolf,

You can try something like that :

<div class="control-group
${empty(actionBean.context.validationErrors[YourInputName]) ? '' : 'error'}
">

Which will add the 'error' class if any error occurs on YourInputName.

Cheers,

Alex.


On Fri, Mar 23, 2012 at 12:19 PM, Rolf <r.su...@minihouse.eu> wrote:

> Hi all,
>
> I am experimenting a bit using Stripes with Twitter's Bootstrap.
>
> While it plays nicely most of the time, i am having trouble signalling form
> validation errors back to the form. Bootstrap wants me to add the error
> class to
> the surrounding .control-group (http://twitter.github.com/bootstrap/base-
> css.html#forms)
>
> Here's a snippet of my Form:
>
> <div class='control-group'>
>    <label class='control-label' for='users'>User</label>
>    <div class='controls'>
>        <s:select name='selectedUser' id='users'>
>            <s:option value=''>Pick one...</s:option>
>            <s:options-collection collection='${actionBean.users}'
> value='id'
> label='name' />
>        </s:select>
>    </div>
> </div>
>
> I implemented the TagErrorRenderer to find the closest parent tag with the
> 'control-group' CSS class, but stripes only seems to have parent tags that
> are
> part of his tag library: the select input tag's parent is the form tag,
> while i
> would've liked it to be the surrounding div tag.
>
> I am thinking now to use jQuery to select all input tags with the 'error'
> class
> and then add the 'error' class to the closest divs with 'control-group'
> class,
> but that would kinda suck :) Is there perhaps a stripes tag that i can use
> that
> renders to a div, so that the TagErrorRenderer can have access to it?
>
> Or does anyone have a better suggestion for me? (apart from ditching
> bootstrap)
> :)
>
> Cheers,
>  Rolf
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to