Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan 1288 posts 3921 karma points c-trib
    Dec 21, 2009 @ 16:30
    Dan
    0

    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.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 21, 2009 @ 16:39
    Dirk De Grave
    0

    Dan,

    could this thread be an anwser to your question?

     

    Cheers,

    /Dirk

  • Dan 1288 posts 3921 karma points c-trib
    Dec 21, 2009 @ 16:49
    Dan
    0

    @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?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Dec 21, 2009 @ 16:52
    Dirk De Grave
    0

    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

  • Dan 1288 posts 3921 karma points c-trib
    Dec 21, 2009 @ 17:02
    Dan
    0

    I don't know - where would I do that in the Umbraco admin system?

  • Dan 1288 posts 3921 karma points c-trib
    Dec 21, 2009 @ 18:53
    Dan
    0

    In the absence of a better solution, I've resolved this with a line of jQuery:

    $(".contourField").children("span").addClass("contourMandatory");

    Hope some find this useful...

  • Bruce Clark 56 posts 80 karma points
    May 06, 2010 @ 19:55
    Bruce Clark
    0

    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 */
    }
  • Tom Fulton 2030 posts 4998 karma points c-trib
    May 06, 2010 @ 20:09
    Tom Fulton
    0

    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>

    And in the CSS:

    #validationmessages span { color:blue !important; }

     

    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

  • Bruce Clark 56 posts 80 karma points
    May 10, 2010 @ 21:39
    Bruce Clark
    0
    <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.

     

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    May 10, 2010 @ 22:00
    Tom Fulton
    0

    Yep - good point, I wrote that sample a little too quickly :)

Please Sign in or register to post replies

Write your reply to:

Draft