Hi Y'all -

I am converting some old code from HTML4 to HTML5 to get better mobile 
support. So far things have been pretty smooth sailing - a testament to 
how well Stripes was designed.

I've been using the Twitter Bootstrap framework to make my job easier 
since it handles a lot of the task of creating a responsive layout for 
you. (See http://twitter.github.com/bootstrap/index.html) I've found 
Stripes and Bootstrap to be a great combo since we've got the dynamic 
attribute versions of the taglibs -- just pass the new HTML5 stuff off 
as a dynamic attribute and away you go.

There's one thing I'm trying to figure out how to do the best -- 
field-level error handling.

If you look at the "Validation states" part of the docs, located here:
http://twitter.github.com/bootstrap/base-css.html#forms you can see that 
Bootstrap brings with it a lot of nice things for showing field-level 
validation errors.

An example of a field with a validation error is:

<div class="control-group warning">
        <label class="control-label" for="inputWarning">Input with 
warning</label>
        <div class="controls">
        <input type="text" id="inputWarning">
        <span class="help-inline">Something may have gone wrong</span>
</div>


There's two things to note here:
1.) There's a span of type "help-inline" that you can append to fields 
with errors. This is super simple to do with Stripes' built in 
field-level validation today, it just goes in as an entry in the 
StripesResources.properties file under stripes.fieldErrors.afterError.

2.) There's an extra class added to the outmost enclosing div (it goes 
from "control-group" to "control-group warning"). This is the one I'm 
trying to figure out how to light up the cleanest way possible.


I've been trying to think of ways to get the extra class to appear in 
that div and mostly coming up empty. The most obvious thing to do to me 
is create a new tag that looks at the field errors to see if this field 
is include and output "error" (or "warning", "info", "success") if 
needed, but this seems kinda crude to me.

Anyone have an idea on how to light up this functionality using Stripes?

Thanks!

- Matt



------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to