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

UPDATE_COL not updating date element

Discussion in 'Community' started by marcelhavlik, Feb 13, 2019.

  1. marcelhavlik

    marcelhavlik Member

    Level: Community
    Hello guys, I cannot update date element with update_col plugin. Latest github version is installed.
    In my table is one column (jdate) with empty date value and need to set current datetime when pressed on this update_col button. The only think I have configured is "Update date" value.
    "Update message" gives a message that one record has been updated, but in table is still 0000-00-00 00:00:00
     
    Last edited: Feb 14, 2019
  2. lousyfool

    lousyfool Active Member

    Level: Community
    I can only guess but from what I read elsewhere here, the jdate element is very new and might have some hiccups, still.
    Use the good old standard "date" element instead (no "j")?
     
  3. marcelhavlik

    marcelhavlik Member

    Level: Community
    Thank you for your feedback, but the same issue is also with legacy date element.
    In the meantime i found a workaround - standard update option with eval value "return date("Y-m-d H:i:s");".
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    What did you originally have in the value for the update?

    -- hugh
     
  5. marcelhavlik

    marcelhavlik Member

    Level: Community
    There is default (empty) date value - 0000-00-00 00:00:00
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    No, I meant what did you have the update_col configured to update "To"?

    As far as I know, the only way to do it would be to do what you wound up doing, enable 'eval' and return a formatted date.

    -- hugh
     
  7. marcelhavlik

    marcelhavlik Member

    Level: Community
    Yes, but there is one option called "Update date" on "Update" tab and I expected that this is something like preset - just choose from dropdown element name, where I need to update date value and thats it.
     
  8. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Oh yeah, I'd forgotten about that. I'll go test it.

    -- hugh
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Works OK for me.

    But ... I just read your OP closer:

    That's why it isn't working. The code checks to see if any fields have been configured for update, and if not, it just returns without doing anything. So if all you've set is the "Update date" option, without configuring anything in the actual fields to update option (or allowing user selection), then it's not going to update the date.

    Basically, that "Update date" is a "record when someone changed values on this row with update_col", and if it isn't changing any values, then it doesn't update the date.

    I guess you could argue that it should consider the "update date" and "update user" as "changed values", so if they are set even if no fields are selected for update, it should still update the date/user. But as-is, it doesn't.'

    So if the only field you want to update is a date, you'll have to do it manually, as a normal field update.

    -- hugh
     

Share This Page