TOPIC:

Validierung Kalender 2 years 2 months ago #226276

  • ANDweb's Avatar Topic Author
  • ANDweb
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 132
  • Thanks: 3
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

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

Validierung Kalender 2 years 2 months ago #226280

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
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

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

Validierung Kalender 2 years 2 months ago #226291

  • ANDweb's Avatar Topic Author
  • ANDweb
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 132
  • Thanks: 3
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

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

Validierung Kalender 2 years 2 months ago #226312

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
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

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

Validierung Kalender 2 years 2 months ago #226316

  • ANDweb's Avatar Topic Author
  • ANDweb
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 132
  • Thanks: 3
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

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

Validierung Kalender 2 years 2 months ago #226331

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
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

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

Moderators: ForumSupport
Time to create page: 0.052 seconds

Summer Sale!

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!