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

date element default not working (or i'm missing something very basic.

Discussion in 'Professional Support' started by skyrun, May 16, 2019 at 9:48 PM.

  1. skyrun

    skyrun Active Member

    Level: Professional
    PHP:

    if ('{srms_work_orders___status_raw}' == '3'
        or '{srms_work_orders___status_raw}' == '4'
        or '{srms_work_orders___status_raw}' == '6' ) {
        echo 'here';
          return date('m/d/y');
    } else {
          return '';
    };
    trying to set the default date based on a status with the code above. 'here' displays so it's not a logic issue.

    but it doesn't work. so tried just this:
    PHP:
    //return '2019-01-01';
    return '01/01/19';
     
    tried both lines, and neither worked to set this element. format of element is m/d/y

    eval is set to YES.
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Which exact Fabrik (3.9 or GitHub)?
    I think you must return the raw date format (YYYY-MM-DD), it's doing on my site.

    But the default is only run on new records, so your other element placeholders will be empty.
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Yup, you'd have to return the default in "raw" (database) format ("Y-m-d H:i:s"), in whatever TZ you have elected to save as (so if "save as local", then your J! TZ, if not then UTC).

    -- hugh
     

Share This Page