TOPIC:

Re:Datum Validieren 13 years 10 months ago #7581

  • TheMuffinMan
  • Visitor
  • Visitor
ok, vor dem hintergrund dass wir jetzt 2:45 uhr morgens haben und mir die augen zuklappen, schlage ich vor ich kümmere mich morgen im laufe des tages darum, ok?

gruss,
Markus

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

Re:Datum Validieren 13 years 10 months ago #7583

  • Topic Author
  • Suli3
  • Offline
  • Junior Member
  • Junior Member
  • Registered
  • Posts: 64
  • Thanks: 0
klaro
gn8

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

Re:Datum Validieren 13 years 10 months ago #7591

  • Topic Author
  • Suli3
  • Offline
  • Junior Member
  • Junior Member
  • Registered
  • Posts: 64
  • Thanks: 0
Hi

Ich habs jetzt

Das habe ich gemacht:
1) Neues Script erstellt mit dem namen ff_validbirthdate (Name muss zwingend stimmen)
2) Den unteren Code eingefügt
3) Im zu prüfenden Feld, den ff_validbirthdate als validierungsscript gewählt
4) Fertig. freu freu

Trotzdem danke für die Hilfe
function ff_validbirthdate(element, message)
{
var checkstr = "0123456789";
var DateField = element;
var Datevalue = "";
var DateTemp = "";
var seperator = ".";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;

   err = 0;
   DateValue = DateField.value;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
     DateTemp = DateTemp + DateValue.substr(i,1);
  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {
      DateField.value = day + seperator + month + seperator + year;
   }
   /* Error-message if err != 0 */
   else { 
   ff_validationFocus(element.name);
      return message;
   }
   if (element.value!='') return ''; 
   if (message=='') message = "Please enter "+element.name+".\n";
      ff_validationFocus(element.name);
      return message;
}

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

Last edit: Post by Suli3.

Re:Datum Validieren 13 years 10 months ago #7593

  • TheMuffinMan
  • Visitor
  • Visitor
super! Gute Nacht!

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

Re:Datum Validieren 13 years 10 months ago #7597

  • Topic Author
  • Suli3
  • Offline
  • Junior Member
  • Junior Member
  • Registered
  • Posts: 64
  • Thanks: 0
Musste nochwas nachbessern fall es jemand braucht bitte diesen code nehmen
function ff_validbirthdate(element, message)
{
var checkstr = "0123456789";
var DateField = element;
var Datevalue = "";
var DateTemp = "";
var seperator = ".";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;

   err = 0;
   DateValue = DateField.value;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
     DateTemp = DateTemp + DateValue.substr(i,1);
  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {
      DateField.value = day + seperator + month + seperator + year;
   }
   /* Error-message if err != 0 */
   else { 
   ff_validationFocus(element.name);
      return message;
   }
   if (element.value!='') return ''; 
   if (message=='') message = "Please enter "+element.name+".\n";
      ff_validationFocus(element.name);
      return message;
}

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

Last edit: Post by Suli3.

Re:Datum Validieren 13 years 10 months ago #7601

  • Topic Author
  • Suli3
  • Offline
  • Junior Member
  • Junior Member
  • Registered
  • Posts: 64
  • Thanks: 0
Noch ne letzte verbesserung

bei dieser version wird man zur startseite weitergeleitet, wenn der user nicht 18 Jahre alt ist, aber vorherst wird hingewisen, dass man nicht 18 jahre alt ist.
function ff_validbirthdate(element, message)
{
var checkstr = "0123456789";
var DateField = element;
var Datevalue = "";
var DateTemp = "";
var seperator = ".";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
var min_age = 18;


   err = 0;
   DateValue = DateField.value;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
     DateTemp = DateTemp + DateValue.substr(i,1);
  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {
      DateField.value = day + seperator + month + seperator + year;
   }
   /* Error-message if err != 0 */
   else { 
   ff_validationFocus(element.name);
      return message;
   }
   		var theirDate = new Date((year + min_age), month, day);
			var today = new Date;

			if ( (today.getTime() - theirDate.getTime()) < 0) {
			/* Eigene meldung definieren */				
			alert("Nur volljährigen Personen ist die Teilnahme gestattet. Sie werden zur Hauptseite weitergeleitet!");
				ff_returnHome();
	}
   if (element.value!='') return ''; 
   if (message=='') message = "Please enter "+element.name+".\n";
      ff_validationFocus(element.name);
      return message;
}

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

Moderators: ForumSupport
Time to create page: 0.053 seconds

Support Chat

Join our Discord chat and enter the Crosstec channels for live-support, chat forums and interact directly with the community!

After joining, please enter the Crosstec Area and use the #crosstec-support or #crosstec-general channels.

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

Subscribe to news and updates!

Special Offer

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!

Live Support Chat Opened!

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