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.

Highlighting Form Entry Rows in the Admin

  1. I have set a field entitled rating that is only viewable within the admin. Basically what this form does is take submissions to be reviewed. The submissions will be looked at by an admin where he/she will edit the form and give a rating based on a multiple choice option: Yes, No or Maybe. What I want to do is highlight the row based on the answer: Green for Yes, Yellow for Maybe and Red for No. Any idea how to approach this?

    Thomas

    Posted 12 years ago on Monday October 3, 2011 | Permalink
  2. You want to change the look in the admin only, based on the rating for that entry?

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink
  3. You could use jQuery to check for the content of the table cell ( td ), then add a class to the parent table row ( tr ) and style it accordingly.. something kind of like this.. it's a rough example but you can get the idea.

    <script type="text/javascript">
    $(document).ready(function() {
         $("body.forms1_page_gf_entries td:contains('Yep')").parent("tr").addClass("greenrow");
         $("body.forms1_page_gf_entries td:contains('Nope')").parent("tr").addClass("redrow");
    });
    </script>

    then add the styles for the classes..

    [css]
    <style type="text/css">
    tr.greenrow {
    	background-color: #CBECA0 !important;
    	color:#598527 !important
    }
    tr.greenrow a {
    	color:#598527 !important
    }
    tr.redrow {
    	background-color: #FAF2F5 !important;
    	color:#790000 !important
    }
    tr.redrow a {
    	color:#790000 !important
    }
    </style>

    and here's what you come up with...

    screenshot: http://bit.ly/pBDev4

    Of course you'd need to customize that and enqueue the scripts those styles in your admin to get it done, but that's one idea.

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink
  4. That works perfectly Kevin! Thanks so much! I was trying to do it with PHP, and it never even occurred to me to use jQuery (which is way easier :-P). I had to tune the styling to be a little more specific so it didn't appear on the edit entry details page, but it looks great! Here's the code I used if anyone ever wants to do this:

    https://gist.github.com/1261479

    This bit of code highlights the entries main page and the individual entry detail page. And Kevin, you deserve a "kevin is really the man" tag. Done. :)

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink
  5. Ha. Thanks for the tag. I'm flattered. I'm glad I could help. Thanks for sharing your final code too - I'm sure other folks will be happy to use/learn from that as well.

    Posted 12 years ago on Tuesday October 4, 2011 | Permalink

This topic has been resolved and has been closed to new replies.