Results 1 to 16 of 16

Thread: Date Field Automatically filled in

  1. #1
    User
    Join Date
    06-20-09.
    Posts
    64

    Default Date Field Automatically filled in

    Hi Thyon !
    Thank you for reply.

    ok .So I try to post my questions here.

    1. I use catalogExt.
    I created a few fields with type [date] without default value.
    Then I tried to fill out it. But every field were filled by default with values of today date (this value filled by javascript I think).
    I filled out only half of my exisiting field and click to save button.

    And in my template (and database) all field were filled. some values - what I enter, others - with value providet by javascript.


    So my question is: How I can disable automatical filling my fileds.

  2. #2
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Date Field Automatically filled in

    Hi Dmitri

    This is a standard TL behaviour for dates and times -- they always complete the latest date and time in the field. I'm not actually sure how you set the field up to have a blank default value. Anyone else know that? leo?

  3. #3
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: Date Field Automatically filled in

    The fields should be blank if you don't specify a default value in the DCA.

  4. #4
    User
    Join Date
    06-20-09.
    Posts
    64

    Default Re: Date Field Automatically filled in

    Hi!
    DCA can you tell me where I can find this??

    In catalog for this fields I don't specify any default value..

  5. #5
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: Date Field Automatically filled in

    Quote Originally Posted by Dmitry
    DCA can you tell me where I can find this??
    I am sorry for the misunderstanding, that was a developer information for thyon

  6. #6
    User
    Join Date
    06-20-09.
    Posts
    64

    Default Re: Date Field Automatically filled in

    Does anyone know how to solve this problem?

    I find where datepicker bind to form and I delete it. but field still has a default value...
    \system\modules\backend\ DataContainer.php
    lines 297-302

    I tried to specify default values ,and this didn't helped.

    as I see, datepicker dind't set default value for this field.
    It set by trypoligh in textField.php.
    Code:
    return sprintf('<input type="text" name="%s" id="ctrl_%s" class="tl_text%s" value="%s"%s onfocus="Backend.getScrollOffset();" />%s',
    							$this->strName,
    							$this->strId,
    							(strlen($this->strClass) ? ' ' . $this->strClass : ''),
    
    							specialchars($this->varValue),
                              
                                                            $this->getAttributes(),
    							$this->wizard);
    but I can't find place where $this->varValue take a default value.

  7. #7
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Date Field Automatically filled in

    I'll look into this dmitry.

  8. #8
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Date Field Automatically filled in

    Hi Leo

    I printed the date value in the DCA and its blank, yet when its rendered by the BE, it still completes the date value? very strange indeed.

    I've noticed that the tl_news.php table does set the time to time(), but when you add a news item, so the date is completed to today. I then went and made the default value for the date set to '' (blank quotes), but it STILL puts the date in the field value. It must be added in DC_Table.php then.


    Any ideas how to fix this?

  9. #9
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: Date Field Automatically filled in

    The news extension uses a couple of callbacks to calculate dates, I guess those are adding the default time.

  10. #10
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Date Field Automatically filled in

    I'm not so sure. I've got a few extensions where i don't actually specify any default value and the current date is automatically completed. How can I troubleshoot where this is happening in DC_Table as I'm unable to determine where it might be adding this.

    I've printed the catalog's DCA before its sent to DC_Table and it does NOT have the default value set (not even a key), so where is the TextField.php widget getting its ability to set the date to the current date then? (I'm not talking about time). I believe this is a bug, so I submitted this a a bugfix.

  11. #11
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Date Field Automatically filled in

    I have tested this on an older version of TL and when you remove the default value (using my gallery extention's date field as a test), it DOES stay blank. However, in TL 2.7.x (tested on 2.7.0 and 2.7.2) this behaviour no longer works. I believe it might have something to do with the introduction of the parseDate() method.

  12. #12
    Core developer
    Official Contao Team
    leo's Avatar
    Join Date
    06-04-09.
    Location
    Wuppertal, Germany
    Posts
    201

    Default Re: Date Field Automatically filled in

    The core engine definitely doesn't add a default date, so you won't find it in the DC_Table.php.

  13. #13
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Date Field Automatically filled in

    well I have installed my gallery extension and when i remove the default value for the "date" of the gallery, it presents the latest date. Why would it do this?

  14. #14
    New user
    Join Date
    09-17-09.
    Posts
    2

    Default Re: Date Field Automatically filled in

    I'm trying to set a default date to catalog date field relative to the date of creation/editing (e.g. 1 year from the current date). Is this possible or am I looking for too much? I've browsed through documentation and nothing relevant popped out of it... Any help would be greatly appreciated.

  15. #15
    User
    Join Date
    06-20-09.
    Posts
    64

    Default Re: Date Field Automatically filled in

    Hi!
    I think you can't do this automaticaly.

  16. #16
    New user
    Join Date
    09-17-09.
    Posts
    2

    Default Re: Date Field Automatically filled in

    Hm.... I'll try to add this functionality somehow. Since I'm new to typolight, any guidelines from tl gurus are welcome :D 8-)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •