TOPIC:

Datum Validieren 13 years 10 months ago #7566

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

Hat jemand einen Script mit dem man ein Datum bzw. Geburtsdatum validieren kann? Dieser Script sollte primär das datum validieren und warnen wenn die person nicht 18 ist.

ich schaff das einfach nicht hab gesucht aber nix gefunden

besten dank für jede hilfe

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

Re:Datum Validieren 13 years 10 months ago #7571

  • TheMuffinMan
  • Visitor
  • Visitor
hast Du mal nach "js age verification" gegooglet? das gibts glaub ich einiges was du dann fuer BF verwenden kannst.

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

Re:Datum Validieren 13 years 10 months ago #7575

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

Ja sowas habe ich aber ich dachte an einen script den ich bei den scripten eingeben kann und jedesmal verwenden kann wenn ich ein datum feld prüfen will.

Ich habe jetzt diesen code für ein feld verwenden (diesen code habe ich auf validation special eingegen.

der ist gut weil auch alle formate akzeptier mit oder ohne punkt oder mi /
function ff_Jahr_validation(element, message)
{
var checkstr = "0123456789";
var DateField = ff_getElementByName('Jahr');
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;
   }
   return '';
}

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

Last edit: Post by Suli3.

Re:Datum Validieren 13 years 10 months ago #7577

  • TheMuffinMan
  • Visitor
  • Visitor
sieht doch schonmal super aus!

wenn du das öfter verwenden willst, dann geh doch einfach mal in die skript bibliothek und mache einen neuen eintrag.
wenn du diesen eintrag dann mit deiner funktion füllst und als "element validierung" festlegst, erhälst du die validierung immer in der liste zum auswählen.

gruss,
markus

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

Re:Datum Validieren 13 years 10 months ago #7579

  • Topic Author
  • Suli3
  • Offline
  • Junior Member
  • Junior Member
  • Registered
  • Posts: 64
  • Thanks: 0
hab ich schon probiert irgendwie klapt das net. Ich weiss nicht was ich ändern muss am script damit das geht.

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

Re:Datum Validieren 13 years 10 months ago #7580

  • Topic Author
  • Suli3
  • Offline
  • Junior Member
  • Junior Member
  • Registered
  • Posts: 64
  • Thanks: 0
Ich brauche hier hilfe

var DateField = ff_getElementByName('Jahr'); //WAS MUSS ICH HIER EINGEBEN ANSTELLE VON ff_getElementByName('Jahr');
ich weiss nicht wie ich das feld ansprechen soll
function ff_Birthdatevalidation(element, message)
{
var checkstr = "0123456789";
var DateField = ff_getElementByName('Jahr'); //WAS MUSS ICH HIER EINGEBEN ANSTELLE VON ff_getElementByName('Jahr');
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;
   }
   return '';
}

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

Moderators: ForumSupport
Time to create page: 0.059 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!