I'm using sorcery for authentication along with twitter bootstrap.
I'd like to style my error messages on my signup form in the style of twitter's bootstrap by changing the default rails <div class="field_with_errors">
that gets added to the DOM.
What's the rails convention for doing something like this?
I suppose you could add some javascript that manipulates the DOM to rename <div class="field_with_errors">
, but that seems like a hack. It seems like there should be a way to override this in rails, but I can't figure out where to do that.
This is how bootstrap requires you to mark up your error to use its built in form error styles:
<div class="control-group error">
<label class="control-label" for="inputError">Input with error</label>
<div class="controls">
<input type="text" id="inputError">
<span class="help-inline">Please correct the error</span>
</div>
</div>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…