WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Datepicker
Check-in and Check-out interaction for min-date (3 posts)

  1. Petr Vujtech
    Member
    Posted 10 months ago #

    Hi, I would like to use this awesome calender for hotel booking.
    Lets have two inputs Check-in and Check-out.
    For check-in I can set min-date:0 (means booking available from today). For check out I need to set min-date equal to the value of Check-in + 1day.

    Similar function is here http://www.eyecon.ro/bootstrap-datepicker/ but I like more contact form 7 calendar.

    Any solution for this issue ?

    http://wordpress.org/plugins/contact-form-7-datepicker/

  2. pauloluft
    Member
    Posted 6 months ago #

    I do not quite understand. You want dates before checkin stay locked?
    See this example:
    http://jsfiddle.net/LLY3g/

    Create inputs with id checkin and checkout:
    Exemplo contact form 7:
    [text date-go id:checkin]
    [text date-back id:checkout]

    Put it in the functions.php file:

    add_action('wp_head', 'ativa_data');
    function ativa_data(){
    ?>
    	<script type="text/javascript">
    		jQuery(function() {
    			jQuery("#checkin").datepicker({
    				dateFormat: 'yy/mm/dd',
    				minDate: new Date(),
    				onSelect: function() {
    					jQuery("#checkout").datepicker('option','minDate',jQuery("#checkin").datepicker( "getDate" ));
    				}
    			});
    			jQuery("#checkout").datepicker({
    				dateFormat: 'yy/mm/dd',
    				minDate: new Date()
    			});
    		});
        </script>
    <?php
    }
  3. andrew_punkle
    Member
    Posted 6 months ago #

    Hey paulo,

    I tried your method but it wasn't quite working for me, which is probably me miss placing some code. I understand placing the

    add_action... at the end of the functions.php file, but the

    [text date-go id:checkin]
    [text date-back id:checkout]

    where exactly are you placing those? I already have an existing form and when I replace the

    [date arrivaldate 20/]
    [date departuredate 20/]

    no calendars pop up, any suggestions?

    Thank you

Reply

You must log in to post.

About this Plugin

About this Topic