TOPIC:

Calendar-Value max_possible_value=today 8 months 3 days ago #252924

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

i want to create a responsive-calender-Field where the maximum value, that can be choose, the value is today.

i create sometimes ago a calender with min field:
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library

//Calendar-Einschränkung, dass nur Daten ausgewählt werden können, die älter als Heute sind

echo '
<script type="text/javascript">                                        
    JQuery(document).ready(function () {                             
        JQuery("#ff_elem171_calendarButton").pickadate({
			format: "dd.mm.yyyy", 
			minDate: "-1m",
			maxDate: "+0d",
			onSet: function() {JQuery("#ff_elem171").val(this.get("value"));}
		});
        });
</script>
';

that dont work :-(

You can help...

also... it is possible to enter value by hand and not only choosing by pickdater.
So i have to create an error-message and validation-code to check, whether the data is in the limit 1 month ago and max. today.

Thank you

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

Calendar-Value max_possible_value=today 8 months 3 days ago #252931

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 136
  • Karma: 1
  • Thanks: 1
okay the value for the calendar... i got it :-)

Now i have to validate the field in two possibilty:
1.) Format: dd.mm.yyyy that works at the moment!
2.) Value: If the value is entered by hand, i have to check it and throw one error if the value is in future. Here you could help, how to validate 2 facts.

Thank you.

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

Calendar-Value max_possible_value=today 8 months 3 days ago #252932

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 664
  • Karma: 4
  • Thanks: 112
Hallo,
var dat = element.value.split(" ")[0];

    var vDate = new Date(Number( dat.split(".")[2]),Number(dat.split(".")[1]-1),Number(dat.split(".")[0]));
    var today = new Date();   
    if( vDate >= today) {
          if (message=='') message = "Start time must be before current time.n";
          ff_validationFocus(element.name);
          return message;
     }
    return '';

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

Calendar-Value max_possible_value=today 8 months 2 days ago #252933

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 136
  • Karma: 1
  • Thanks: 1
hello and thank you:

i have to ask...
element.value.split(" "): Why?
You check the case, that the person entered the space after the entered date?

dat.split(".")[1]-1: why -1?

thank you

and some other thought...
is it possible to lock this field for entering by hand and only allow to use the calendar-button to choose the value?

than i could check this field easier because i could define how the choosen value would be saved / displayed.

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

Last edit: Post by Mister.Miracle. Reason: ask: lock of entery by hand

Calendar-Value max_possible_value=today 8 months 2 days ago #252939

  • Eddy.vh's Avatar
  • Eddy.vh
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 664
  • Karma: 4
  • Thanks: 112
Hi,

element.value.split(" "): Why?


I guess if the date also contains the time and is separated by a space.

dat.split(".")[1]-1

Because in scripts the months are calculated from 0 to 11 and not from 1 to 12.

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

Calendar-Value max_possible_value=today 8 months 1 day ago #252991

  • Topic Author
  • Mister.Miracle
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 136
  • Karma: 1
  • Thanks: 1
and the question...

possibility of lock entering by hand date-values and only allow to use the date-/calendar-picker-button beside the field. is it possible or not?

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

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.051 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!