TOPIC:

Birth date dd.mm.yyyy format 6 days 19 hours ago #250887

  • Topic Author
  • Yvjo
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 22
  • Thanks: 0
Hello,
I will ask for a complete Birthdate (dd.mm.yyyy) in a form.
How can I format and check that the customer give his complete birthday date and not only dd.mm or yyyy ?
Thank you

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

Birth date dd.mm.yyyy format 6 days 18 hours ago #250890

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2193
  • Karma: 3
  • Thanks: 198
Hi,

here is an example:

File Attachment:

File Name: DateV10620...17-2.zip
File Size:70 KB

Another customer had the same request.

To test this, download->unzip and install it (BF->Configuration->Package Installer->select file->Install Package). After that this form is located in Manage Forms

The code is located in element->Properties->Validation->check Custom.

EDIT: for birthday date use this code as validation:
function ff_NAMEOFYOURELEMENT_validation(element, message)
{
 if(element.value.split(".").length != 3){return message == '' ? element.name+" faild in my test.n" : message}
 
     var vDate = new Date(Number( element.value.split(".")[2]),Number(element.value.split(".")[0]-1),Number(element.value.split(".")[1]),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+" faild in my test.n";
          return message;
     }
     return '';
} // ff_NAMEOFYOURELEMENT_validation
Please replace NAMEOFYOURELEMENT with name of your element (not title).


Regards,
Tihana
Attachments:

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

Last edit: Post by tihana.krivic. Reason: forgot to add code for birthday date

Birth date dd.mm.yyyy format 6 days 28 minutes ago #250911

  • Topic Author
  • Yvjo
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 22
  • Thanks: 0
Thank you Tihana.
It works !
In the package in zip file you send me there is an error in
if(vDate < today) instead of if(vDate > today) ;)
Where can I found some examples scripts ?
Thank you

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

Birth date dd.mm.yyyy format 6 days 11 minutes ago #250913

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 2193
  • Karma: 3
  • Thanks: 198
Hi,

in the package that I sent to you (if date is in the past vDate < today) error message appears, and that is the reason why I put here the code, and change this to (vDate > today), and this should works for birthday :)

Regards,
Tihana

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

  • Page:
  • 1
Time to create page: 0.040 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!