test
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • brentwilliams2 Friend
    #192295

    Version 1.0.4

    For the Publish Date field with DATE_CAL field type, if I want the input to show the current time as the default, what do I put in the Init Value?

    Luna Garden Moderator
    #512528

    Hello BrentWilliams,

    At this time, we don’t have function support to set default value for Datetime type. But we’ll try to add this customization for you, just note that, it won’t work perfectly. But before that, we want to know where you want to add default date, for font-end or back-end ?

    brentwilliams2 Friend
    #512621

    It would be for the front end. The main problem is that users get an error if they don’t use the right format, so having a default not only makes it easier, but it also gives them the format if they want to change. (I realize that they can click on the calendar and click on the date, to see the format, but they don’t always do that).

    For anyone else reading this, I ended up putting 0000 as the default. What that does is essentially sets the job to publish as of the start of the day they published it on. Since that means it is essentially back-dated, then it will automatically show on the site unless they change it. Seems to be working ok as of right now.

    HeR0 Friend
    #512658

    Hi Brent,

    You could use default value for current datetime for this field by custom code from rendfiled library.
    – Open file components/com_jajobboard/asset/rendfield.php
    – Go to line 359
    [PHP]if ($value && is_string($value)) {
    $value = date(“Y-m-d H:i:s”, strtotime($value));
    }
    [/PHP]- Change it to
    [PHP]if ($value && is_string($value) && $value != ‘0000:00:00’) {
    $value = date(“Y-m-d H:i:s”, strtotime($value));
    } else {
    $value = date(“Y-m-d H:i:s”);
    }[/PHP]
    Also, you could change in the backend too by editing rendfield.php file there.
    Hope this helps

Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 3 voices, and was last updated by  HeR0 11 years ago.

We moved to new unified forum. Please post all new support queries in our New Forum