Tagged: ,

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #771229

    Hello Kriesi Support

    is it possible to set the datepicker in your forms to only show Dates in the Future from today?
    Right now one can select whatever date he wants but i want to limit this to dates in the future.

    Or as an alternative limit it to just 12 months into the future, starting from today .

    Thanks und best regards
    Mats

    #771314

    Hi MatthiasKrebs!

    Our date pickers are not so advanced to be honest but you can do with some custom coding
    https://kriesi.at/support/topic/disable-specific-dates-in-datepickerthttpwww-kriesi-atsupporttopicdisable/

    Here are some exmaples, you can follow them, if you have issues, consider to hire a developer to help you with the modifications.

    Thank you

    Cheers!
    Basilis

    #771322

    hm i think the rule is set on class-form-generator.php since line 463ff
    ( it is in enfold – framework – php )

    maybe you can insert here from 494 the minDate and maxDate options
    https://jqueryui.com/datepicker/#min-max

    from about line 509:

                   changeMonth: true,
    		changeYear: true,
    		minDate: 0,
    		maxDate: "+12m"
                }); });';

    after ChangeYear i inserted those two parameters
    minDate: 0 – means today on
    maxDate i have set +12month
    i deleted the year range parameter

    or look here: https://api.jqueryui.com/datepicker/#option-minDate

    don’t know if there is a way to make it via child-theme hook

    #771326

    Hey!


    @Guenni007
    thank you once again for helping out!!

    Regards,
    Basilis

    #772291

    Works like charm, thanks a lot @guenni007 (If you want to have a look: https://alpina-paragliding.ch/gleitschirm/tandemfluege/)
    Now i am able to customize even more stuff i need, key question as always : which file to change and where to find it.
    But for now: One step closer for going live…

    But how do i hook it into the child theme? Right now i’ve changed main theme and so i have lost update compatibility! Something i do not like much…

    Thanks and many greetings
    Mats

    #772455

    overwrite the php you have inserted to your parent theme with original and try this here in child-theme functions.php

    coming soon – seem to be a bit buggy :lol

    no -sorry i managed it to insert those settings but on enfold then something mismatched.
    maybe one mod could help here.

    • This reply was modified 7 years, 7 months ago by Guenni007.
    #774018

    Hi,

    Please copy unmodified enfold/framework/php/class-form-generator.php file and paste it inside enfold-child folder and find following at the top and remove it (please do not remove PHP opening tag)

    
    if (  ! defined( 'AVIA_FW' ) ) exit( 'No direct script access allowed' );

    and then add following code to Functions.php file of your child theme

    
    require( 'class-form-generator.php' );

    and then apply the changes on the file on your child theme


    @Guenni007
    Thanks for your help! :)

    Best regards,
    Yigit

    #774037

    hm – i thought we can manage it via :

           $.datepicker.setDefaults({
    		minDate: 0,
    		maxDate: "+12m"
           })

    but when i’m sucessful with that code inserted – some other things on enfold do not work correct. – And i don’t know realy why

    #774058

    or – because it is an own action

    add_action( 'wp_footer', 'helper_print_datepicker_script' );

    that we can remove the action and set up a new one.

    #774080

    could you please try to do this in functions.php of child-theme:

    function my_datepicker_defaults() {
    ?>
     <script type="text/javascript">
    	jQuery(document).ready(function(){ 
    		jQuery.datepicker.setDefaults({
    		minDate: 0,
    		maxDate: "+12m"
           		});
      	});   
     </script>
    <?php
    }
    add_action('wp_footer', 'my_datepicker_defaults', 20);

    this seems to work on my test installation

    #774083

    this gives you the opportunity to do it via if clauses :
    (in this case only for page 3191

    function my_datepicker_defaults() {
    if( is_page(3191) ) {
    ?>
     <script type="text/javascript">
    	jQuery(document).ready(function(){ 
    		jQuery.datepicker.setDefaults({
    		minDate: 0,
    		maxDate: "+12m"
           		});
      	});   
     </script>
    <?php
    }
    }
    add_action('wp_footer', 'my_datepicker_defaults', 20);

    see it in action: not for this sites: https://webers-testseite.de/kokon/elements/contact-form/
    but for that 3191 site: https://webers-testseite.de/kokon/flexbox/

    #775442

    Hi,


    @Guenni007
    Thanks as always :)

    Best regards,
    Yigit

    #775892

    @Guenni007
    You sir are an outstanding genius. Thanks so much for your help and support. Awesome!


    @Yigit

    Thanks for your help too. Everythings fine now

    Greetings
    Mats

    #775932

    Hi,

    Let us know if you have any other questions or issues :)

    Best regards,
    John Torvik

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.