TOPIC:

Error while creating DatePicker 2 weeks 5 days ago #256575

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 126
  • Karma: 1
  • Thanks: 1
Hello,

i have a calendar-field created.
There i want some restriction, but i got error or it dont work, like i thought.
There i try to explain, and what i have done... so i hope you will say, what ia have done wrong :-(
echo '
<script type="text/javascript">                                        
    JQuery(document).ready(function () {                             
        JQuery("#ff_elem614_calendarButton").pickadate({
			editable: false,
			format: "dd.mm.yyyy", 
			min: new Date("21.03.2021");,
			selectMonths: true,
			selectYears: true
			onSet: function() {JQuery("#ff_elem614").val(this.get("value"));}
		});
    });
</script>
';

what i want:

1.) i want, that the user is NOT able to enter valuedata by hand, only by the picker
2.) i want to get selecting years, but only this year and the next year - the restriction is not implemented but should impletented in future.
3.) i want a min-value: Like the way above... i dont work. i tried other valuedata like min: "21.03.2021" or some other way, i dont work :-(
4.) also i want to enter the min max values automatic and not by hand... so somewhere i want to create a variable $today or this year and use it in the restrictions. on which position i should create this variable and by what script (php or Javascript or JQuery)?


Note:
  • the elem614 i got by Chrome - F12 and it is right :-)
  • I entered the code in the form-option - more - initialize form-area as a special-code

Thank you for helping

Please Log in or Create an account to join the conversation.

Error while creating DatePicker 2 weeks 4 days ago #256588

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 4969
  • Karma: 3
  • Thanks: 356
Hi,

1) make this field readonly

Go to your form->Advanced->More options->Script->Initialization script->check Custom and put:
function ff_formaname_init()
{
ff_getElementByName('calendarname').readOnly=true;
} // ff_formname_init
Please replace formname with name of your form (not title), and calendarname with name of your responsive calendar (not title).

2) selectYears: 2,
will show 2021,2022 and 2023

but selectYears: 1,
will show only 2021

3) min: new Date(2021,2,21),
min date is 21.3.2021
month is calculated from 0 to 11 and that is the reason why 2 is for March

The code in before form pieces looks like:
echo '<script type="text/javascript">
		JQuery(document).ready(function () {
					
			JQuery("#ff_elem5030_calendarButton").pickadate({
				format: "dd.mm.yyyy", 
				selectYears: 2, 
			        min: new Date (2021, 2, 21),
				selectMonths: true,
				editable: false,
				firstDay: 1,
				onSet: function() {JQuery("#ff_elem5030").val(this.get("value"));}
			});
                    });
	</script>';
Please replace #ff_elem5030 with ID of your calendar (right click to browser->Inspect->find ID for calendar).

Let me know if you need more help

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Error while creating DatePicker 2 weeks 3 days ago #256664

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 126
  • Karma: 1
  • Thanks: 1
Thank you... i works fine, but i dont want to enter the date by hand.
i want to get it automatical and enter it als min or max.

maybe:
var heute = new Date();
var year = heute.getFullYear();
var month = heute.getMonth();
var day = heute.getDay();
var nextyear = year +1;

and after that enter the value min:
min: (year,month-1,day);
max: (nextyear,11,31);

But this dont work.
Do i missunderstand the system?

Have i create the date by Javascript or by PHP`?

Please Log in or Create an account to join the conversation.

Error while creating DatePicker 2 weeks 3 days ago #256665

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 4969
  • Karma: 3
  • Thanks: 356
Hi,

- automatic date (e.g you don't want to pick date today date should be displayed)??
If you want to this, then you can use javascript, and I will help you with the code

Basically, min and max date you can add in responsive calendar as I added it in message above for min date

Waiting for your feedback

Regards,
Tihana

Please Log in or Create an account to join the conversation.

Last edit: Post by tihana.krivic.

Error while creating DatePicker 2 weeks 2 days ago #256710

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 126
  • Karma: 1
  • Thanks: 1
hello,
i have to create a form for sending holiday-planing.So i have to create the first day (maybe like something like that):
firstday_min = today + 1;
fristday_max = new date(year(today) + 1, 11, 31);
lastday_min = today +2;
lastday_max = new Date(year(today) + 1, 11, 31);
so i can use the same value of today and the corresponding values (lastday of next year, tomorrow, overtomorrow, ...) at different positions in form creation.

but i understand... the value-date-creation is done by javascript... then i could see the javascript docu of date... so i could create it (i hope ) :-P

Thank you

Please Log in or Create an account to join the conversation.

Error while creating DatePicker 2 weeks 1 day ago #256731

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 4969
  • Karma: 3
  • Thanks: 356
Hi,

sorry for late reply, I had day off.

If you are using responsive calendar, there you can't add firstday_min, only min, max for configuration of calendar in before form pieces.

Also, here are the docs for responsive calendar:
amsul.ca/pickadate.js/date/#limits

Hope this helps

Regards,
Tihana
The following user(s) said Thank You: Mister.Miracle

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!