How to set Responsive calendar min-variable dynamically

  • Joe Cool
  • Joe Cool's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 49
  • Thank you received: 0

Joe Cool created the topic: How to set Responsive calendar min-variable dynamically

Hello,
I found all the adjustments hints for the responsive calendar, very nice.
But I need to set the min-date of my "departure-calendar-field" to be the date value +1 of the "arrival-calendar-field".
I can't get it to work. My attempt was this:
// "ARRIVAL Calendar Element"
    JQuery("#ff_elem9509_calendarButton").pickadate({
        format: "dd.mm.yyyy",
        editable: false,
        selectYears: 2,
        selectMonths: true,
        firstDay: 1,
        min: 3,
        max: 365,
        onSet: function() {JQuery("#ff_elem9509").val(this.get("value"));}
    });
// "DEPARTURE Calendar Element"
    JQuery("#ff_elem9510_calendarButton").pickadate({
        format: "dd.mm.yyyy",
        editable: false,
        selectYears: 2,
        selectMonths: true,
        firstDay: 1,
        min: function() {JQuery("#ff_elem9509").val();},
        max: 365,
        onSet: function() {JQuery("#ff_elem9510").val(this.get("value"));}
    });

Does anyone have an idea, how to solve this? I want the departure date to be limited to Arrival + 1, so no wrong dates can be entered.

THX

If SIN= "true" goto HELL;
else goto HEAVEN;
#237696
  • Posts: 2784
  • Karma: 95
  • Thank you received: 375

mihaela replied the topic: How to set Responsive calendar min-variable dynamically

Hello,

You can try to use this solution crosstec.org/en/forums/15-usage/116892-d...nd-after.html#201745 which will work what you want. put the suggested code in the initialization script.
In order for that example to work, the names of the responsive calendar have to be "arrival" and "departure".

Note that in that case, the calendar will look a bit different. You will see how it looks when you test it.
This way the person filling in the form won't be able to select departure date before the arrival date

The other option would be to add validation to the calendar element so that, when clicking on the submit button, if the departure date is not after the arrival date an error message will appear. User will have to change that in order to be able to submit the form.
Here you can take a look at an example code for a validation code crosstec.org/en/forums/1-forums/125424-c....html?start=6#232597 .

Let me know whether this helped and whether you have managed to set it for your form.

Regards,

Mihaela
#237703
Moderators: ForumSupporttomeperica
Time to create page: 0.059 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here