PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Style Required Field Differently

  1. The span class gfield_required is only applied to the asterisk that is added to a field that is set to required. I'd like to be able to style the entire label, not just the asterisk. Aside from selecting each required field manually by using their li IDs, is there any way I can do this?

    Thanks

    Posted 13 years ago on Wednesday March 9, 2011 | Permalink
  2. In fact, I think this is a flaw in the way this is coded to begin with, given an item can have multiple classes.

    Instead of having

    <label for="input_1_2" class="gfield_label">FIELD<span class="gfield_required">*</span></label>

    span.gfield_required {color: #FFFFFF; font-weight: bold;}

    It makes much more sense to have the code rendered as

    <label for="input_1_2" class="gfield_label gfield_required">FIELD<span>*</span></label>

    That way the entire required field can be targeted, or just the span for the asterisk.

    EDIT

    For now I have settled with the following solution, but I doubt it's the best

    jQuery(document).ready(function() {
    	jQuery('label.gfield_label:has(span.gfield_required)').css('color', '#800000');
    });
    Posted 13 years ago on Wednesday March 9, 2011 | Permalink
  3. Thanks for the insight. I do agree with you. I think this can be done better. There are a couple of things like this that I want to improve moving forward and we'll be working on those in one of the post 1.5 releases.

    Posted 13 years ago on Wednesday March 9, 2011 | Permalink