Ergebnis 1 bis 14 von 14

Thema: Date of birth in front-end only next day

  1. #1
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

    Standard Date of birth in front-end only next day

    Hi,

    I find a bug in 3.3.6 to select the date of birth of member

    Is impossible in front end to select an older date as the date of the day
    it's pity to select a date of birth

    I don't see the solution in the Contao Changelog...

    Have you a solution ?
    Geändert von tom-over (10.02.2015 um 12:15 Uhr)

  2. #2
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

  3. #3
    Contao-Nutzer Avatar von Hanski
    Registriert seit
    23.02.2010.
    Beiträge
    59

    Standard

    Salut!
    When you add the datepicker you apparently set the option "minDate" which creates your problem. This should probably be "maxDate" as you use it for birthdays.

  4. #4
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

    Standard

    But I don't see the option "minDate".
    In a module register, the form is automatic

    I d'ont understand...

    In a page source :
    HTML-Code:
    <script>
    window.addEvent('domready', function() {
      new Picker.Date($$('#ctrl_dateOfBirth'), {
        'draggable': 'false',
        'pickerClass': 'datepicker_bootstrap',
        'useFadeInOut': '!Browser.ie',
        'startDay': 0,
        'titleFormat': '%B %d%o, %Y',
        'minDate': new Date(2015, 1, 11),
        'positionOffset': {x:0,y:0},
        'format': '%d-%m-%Y'
      });
    });
    </script>
    Geändert von tom-over (11.02.2015 um 10:25 Uhr)

  5. #5
    Contao-Nutzer Avatar von Hanski
    Registriert seit
    23.02.2010.
    Beiträge
    59

    Standard

    With just Contao Core you get the form alright, but you don't get the datepicker. This has to be added, for example in your template (otherwise you wouldn't get the JS-code you posted).

    Where do you get your other fields (e.a. 'profession'?) from? Maybe you might look there for more options.

  6. #6
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

    Standard

    Excuse me but my english is not very good...

    Exactly what I need to change ?

    But dateofbirth is natif in Contao (in core)

    Is bug of Contao no ?

    I used the registration module to add member...
    Geändert von tom-over (11.02.2015 um 11:22 Uhr)

  7. #7
    Contao-Nutzer Avatar von Hanski
    Registriert seit
    23.02.2010.
    Beiträge
    59

    Standard

    I could try in french, but I'm not sure if that's better

    You need to find the place where the javascript code for the datepicker is added.

    First check the template you use in the registration module.

    If it's not there: which extensions do you use to make the other fields in your form (for example 'profession')?

    But dateofbirth is natif in Contao (in core)
    the field: yes
    but: you don't have option to add datepicker, or do you? and datepicker is where your problem is
    Geändert von Hanski (11.02.2015 um 11:29 Uhr)

  8. #8
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

    Standard

    I forgot to install the extension Field Calendar
    https://contao.org/en/extension-list...060029.en.html

  9. #9
    Contao-Urgestein Avatar von cliffparnitzky
    Registriert seit
    08.10.2010.
    Ort
    Lüneburg
    Beiträge
    2.451
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Yep, that was all we needed to know !!!

    For form fields of this type you get the option for "Date direction" ... the selected value in your birthday field is ... "Only dates in the future (including today)".

    This has to be changed to "Only dates in the past".

  10. #10
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

    Standard

    I found this code :

    Code:
    switch ($dateDirection) {
    
                case '+0':
                    $arrConfig['minDate'] = 'new Date(' . date('Y') . ', ' . (date('n')-1) . ', ' . date('j') . ')';
                    break;
    
                case '+1':
                    $time = strtotime('+1 day');
                    $arrConfig['minDate'] = 'new Date(' . date('Y', $time) . ', ' . (date('n', $time)-1) . ', ' . date('j', $time) . ')';
                    break;
    
                case '-1':
                    $time = strtotime('-1 day');
                    $arrConfig['maxDate'] = 'new Date(' . date('Y', $time) . ', ' . (date('n', $time)-1) . ', ' . date('j', $time) . ')';
                    break;
            }
    I do this :
    Code:
     switch ($dateDirection) {
    
                case '+0':
                    $arrConfig['minDate'] = 'new Date(1920, 1, 1)';
                    break;
    
                case '+1':
                    $time = strtotime('+1 day');
                    $arrConfig['minDate'] = 'new Date(' . date('Y', $time) . ', ' . (date('n', $time)-1) . ', ' . date('j', $time) . ')';
                    break;
    
                case '-1':
                    $time = strtotime('-1 day');
                    $arrConfig['maxDate'] = 'new Date(' . date('Y', $time) . ', ' . (date('n', $time)-1) . ', ' . date('j', $time) . ')';
                    break;
            }
    But I have a message error :
    Please enter a date in the future (including today).
    Geändert von tom-over (11.02.2015 um 13:41 Uhr)

  11. #11
    Contao-Urgestein Avatar von cliffparnitzky
    Registriert seit
    08.10.2010.
    Ort
    Lüneburg
    Beiträge
    2.451
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    you do not have to change code ... go to the form generator in backend ... select your form ... serach the birthday field ... edit it and change the "Date direction" field.

  12. #12
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

    Standard

    I don't understand

    Where in backend ?

    I not use the form generator... is a module member register in my website.

    I make a modul to add the field in tl_member : profession, level tennis, ....
    Geändert von tom-over (11.02.2015 um 16:19 Uhr)

  13. #13
    Contao-Nutzer Avatar von Hanski
    Registriert seit
    23.02.2010.
    Beiträge
    59

    Standard

    alors, j'essaie en francais...

    Tu as écrit de l'extension 'calenderfield', tu l'utilises ou pas?

    Si non, je ne sais pas, comment tu as attaché le datepicker au formulaire autre que addition de le code javascript dans le template pour la module.
    Peux-tu regarder à ce template, si il y a cet code?

    edit:
    Un screenshot de la module membre registrer pourrait aider aussi
    Geändert von Hanski (11.02.2015 um 16:44 Uhr)

  14. #14
    Contao-Nutzer
    Registriert seit
    28.06.2010.
    Ort
    Frankreich
    Beiträge
    29

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •