Is it just me or is there no CSS class hook for the mandatory field error messages in Contour? They just seem to have 'color: red' hard-coded into them.
@Dirk: no, I don't think so - I've tried with default style sheet and without, but the styling of those elements is always the same as it seems to be hard coded. Perhaps this is an oversight in the core functionality? Is there somewhere I can report this?
Dan, unfortunetely that solution isn't really workable. The reason is because you have no way to talk directly to mandatory/error span tags. They have no assigned class and therefore can't be targeted. If you use your solution you will target all spans, including those that wrap around checkboxlists, etc.
What we really need is a class assigned to the mandatory span field, I did this perviously before using contour and it works great.
#contour span.mandatory { color: #009 !important; /* used to overwrite default red styling on the error field */ }
I've worked around this by modifying the RenderForm control (/usercontrols/umbracoContour/RenderForm.ascx) and wrapping the validators in a span with an ID. Then you can target spans inside that ID. The only caveat is since the span has an inline style hardcoded to red, you'll need to add !important to your CSS style to make it override.
IE:
<!-- Validation --> <span id='validationmessages'> <uform:RequiredValidator ID="mandatory" runat="server" ErrorMessage="mandatory" Visible="false" Display="Dynamic" /> <uform:RegexValidator ID="regex" ErrorMessage="The field could not be validated" runat="server" Visible="false" Display="Dynamic" /> </span>
<span class='error'> <uform:RequiredValidator ID="mandatory" runat="server" ErrorMessage="mandatory" Visible="false" Display="Dynamic" /> <uform:RegexValidator ID="regex" ErrorMessage="The field could not be validated" runat="server" Visible="false" Display="Dynamic" /> </span>
Tom,
Good insight, one thing I changed from what you do is to not use an ID but rather a class. Because these mandatory spans get generated for each mandatory field you end up with the same ID, which invalidates and can mess a few things up.
Style mandatory field
Is it just me or is there no CSS class hook for the mandatory field error messages in Contour? They just seem to have 'color: red' hard-coded into them.
Dan,
could this thread be an anwser to your question?
Cheers,
/Dirk
@Dirk: no, I don't think so - I've tried with default style sheet and without, but the styling of those elements is always the same as it seems to be hard coded. Perhaps this is an oversight in the core functionality? Is there somewhere I can report this?
there's no specific issue tracker page, can't you submit bugs/issues from within umbraco (Or is this only possible in trial mode)?
/Dirk
I don't know - where would I do that in the Umbraco admin system?
In the absence of a better solution, I've resolved this with a line of jQuery:
Hope some find this useful...
Dan, unfortunetely that solution isn't really workable. The reason is because you have no way to talk directly to mandatory/error span tags. They have no assigned class and therefore can't be targeted. If you use your solution you will target all spans, including those that wrap around checkboxlists, etc.
What we really need is a class assigned to the mandatory span field, I did this perviously before using contour and it works great.
I've worked around this by modifying the RenderForm control (/usercontrols/umbracoContour/RenderForm.ascx) and wrapping the validators in a span with an ID. Then you can target spans inside that ID. The only caveat is since the span has an inline style hardcoded to red, you'll need to add !important to your CSS style to make it override.
IE:
And in the CSS:
Not the most elegant solution, but it seems to work. Not sure why the red is hardcoded...
I've had to modify the RenderForm on several occasions, for example to put the Tooltip above the Field.
Thanks,
Tom
Tom,
Good insight, one thing I changed from what you do is to not use an ID but rather a class. Because these mandatory spans get generated for each mandatory field you end up with the same ID, which invalidates and can mess a few things up.
Yep - good point, I wrote that sample a little too quickly :)
is working on a reply...