1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

[SOLVED] Change Element color (date) if value is less than two years ago

Discussion in 'Community' started by maxinic, Apr 15, 2021.

  1. maxinic

    maxinic Member

    Level: Community
    Hy everyoneI
    I have a form with a date type element. I would like to turn red format if the date entered is before two years ago. is it possible to do it in the list? sorry i resumed fabrik after 9 years and i'm a bit rusty
     
  2. dimoss

    dimoss Well-Known Member

    Level: Community
  3. maxinic

    maxinic Member

    Level: Community
    Thanks...i try
     
  4. maxinic

    maxinic Member

    Level: Community


    i followed the post and now i have a calc field (set this element to "Use as row class" in List view settings) which returns me a css class name. Now I have edited my custom_css.php but nothing happens. this is my custom_css.php :

    header('Content-type: text/css');
    $c = $_REQUEST['c'];
    echo <<<EOT
    /* BEGIN - Your CSS styling starts here */


    #listform_$c tr.colred td.anagtafica___diffdata {color:red;};
    #listform_$c tr.colwhite td.anagtafica___diffdata {color:white;};

    #listform_$c {
    margin-top: 25px !important;

    }
     
  5. dimoss

    dimoss Well-Known Member

    Level: Community
    The calc element should return a string based on the date comparison.
    Based on that string value you prepare the custom_css.php
    Have you followed this procedure?
     
  6. maxinic

    maxinic Member

    Level: Community
    First of all, Thanks Dimoss
    Yes my calc element can return only 2 string: colred or colwhite so i have edited my custom_css.php

    so:
    #listform_$c tr.colred td.anagtafica___diffdata {color:red;};
    #listform_$c tr.colwhite td.anagtafica___diffdata {color:white;};
    but nothing happen
    (if i print my calc element it's return colred or colwhite)
     
  7. maxinic

    maxinic Member

    Level: Community
    [SOLVED] I was just getting the element name wrong in the CSS. thank you very much.
     

Share This Page