Validierung Kalender

  • ANDweb
  • ANDweb's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 131
  • Thank you received: 3

ANDweb created the topic: Validierung Kalender

Ich habe Validierungsbeispiele für den Kalender in der Dokumentation gefunden (u.a. crosstec.org/de/support/online-dokumenta...past-yyyy-mm-dd.html ) jedoch nicht für das bei mir eingesetzte Format: DD-MM-YYYY. Wie muss ich den Code für die Custom Validierung ändern, damit das bei mir auch funktioniert?

Danke und Grüße
Uli
#226276
  • Posts: 2645
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Validierung Kalender

Hello,

I hope we can continue this discussion in English as we're a little low on German speaking staff currently.

If I understood you correctly, you have an calendar element with date format DD-MM-YYYY and want to check whether the date is in the past.

Here is the code you have to put in the Validation section to make this work.
function ff_CALENDARITEMNAME_validation(element, message)
{
     if(element.value != '') {
          if(element.value.split("-").length != 3){return message == '' ? element.name+" faild in my test." : message}

          var vDate = new Date(Number( element.value.split("-")[2]),Number(element.value.split("-")[1]-1),Number(element.value.split("-")[0]),0,0,0).getTime();

          var today = new Date();

          today.setHours(0);
          today.setMinutes(0);
          today.setSeconds(0);
          today.setMilliseconds(0);
          today = today.getTime();
          
          if(vDate < today)
          {
               if (message=='') message = element.name+" failed the test. Please select Date in the future.";
               return message;
          }
     } 
     return '';
}
NOTE: Please in the code above replace CALENDARITEMNAME with the name of the calendar element.

Let me know if this works how you wanted.
If you have more questions, feel free to ask.

Regards,

Mihaela
#226280
  • ANDweb
  • ANDweb's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 131
  • Thank you received: 3

ANDweb replied the topic: Validierung Kalender

Thx alot Mihaela!
The script works, but unfortunately only if the appointment is in the past.
Is it possible that the script also checks the content?
The calendar element should be a mandatory field, an empty field should be displayed accordingly.

Regards, Uli
#226291
  • Posts: 2645
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Validierung Kalender

Oh ok, so you just want to check that the calendar filed is not left empty?

To do so go to Properties of the calendar element. In the Validation section, check the Required checkbox, select Library as Validation Type.
Select the FF::ff_valuenotempty Script.

That will check if some date is selected for that calendar field. If it is not, it will display an error message.
You can change that message in the Error message field.

Let me know if this is what you wanted to achieve.

Regards,

Mihaela
#226312
  • ANDweb
  • ANDweb's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 131
  • Thank you received: 3

ANDweb replied the topic: Validierung Kalender

This does'nt work - at least not on the one website.
It is a multilingual website. For each page a separate form was created, so that the reply mail could be created in different languages.
All form fields display the error message, except the calendar item. Although the script (FF::ff_valuenotempty) is selected there.

The next problem is that the German error messages are displayed when needed, the texts can no longer be edited in the backend. In the field of German language of the German form, English texts are displayed there :/

Regards, Uli

This message contains confidential information
#226316
  • Posts: 2645
  • Karma: 92
  • Thank you received: 354

mihaela replied the topic: Validierung Kalender

Hello,

That is strange behavior, the script FF::ff_valuenotempty should work for calendar element. I will just check to be sure, you did check the check the Required checkbox?
I've tried to enter the backend but I get the "Your connection to this site is not private" message and can't enter it.

I went to the
This message contains confidential information
and tried to enter form in different languages. For me the German version displays error messages in German, and English form error messages in English. Did you fix that problem, or I didn't understand what is the problem?

Also, I see that this form in German, English, Italian and Netherlands display this message:
Fehlermeldung   : Undefined index: size
Please on your Recaptcha element change size to compact, save the whole form. Then change the size back to normal and save the form and the error should be gone.

Regards,

Mihaela
#226331
Moderators: ForumSupporttomeperica
Time to create page: 0.147 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