TOPIC:

Conditional Field If Less than 18 Years Old 1 year 2 months ago #236243

  • Topic Author
  • multiweb
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
My email address is adrian@multiwebmarketing.co.uk, if you could send me an email I am more than happy to provide administrator access to the website, if you don't mind continuing to help.

Thanks

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

Conditional Field If Less than 18 Years Old 1 year 2 months ago #236276

  • Topic Author
  • multiweb
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
Hi Mihaela,

Have you any idea what else could be causing the issue?

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

Conditional Field If Less than 18 Years Old 1 year 2 months ago #236278

  • Topic Author
  • multiweb
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
Would you try sending me your form as a package to try please? Or even the full Joomla 3 database and website files?

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

Conditional Field If Less than 18 Years Old 1 year 2 months ago #236297

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 414
Hello,

After going through the form that you've sent me in the package once more, I've realized where is the issue.

As written in along the code suggested, that code will work for dates in format dd/mm/yyyy and you are using dd-mm-yyyy format in your form.

Therefore please replace your Initialization script with this one:
function ff_registration_init()
{
setInterval(calAge, 500);
} // ff_registration_init

function calAge(){
var dateBirth = ff_getElementByName('dobfield').value;
    var dobParts = dateBirth.split("-");
     var now = new Date();
  var dobParts = dateBirth.split("-");
  var dob = new Date(dobParts[2], (dobParts[1] - 1), dobParts[0]);
  
  var dobYear = dob.getFullYear();
  var dobMonth = dob.getMonth();
  var dobDay = dob.getDate()

  var age = now.getFullYear() - dobYear;
  var ageMonth = now.getMonth() - dobMonth;
  var ageDay = now.getDate() - dobDay;

  if (ageMonth < 0 || (ageMonth == 0 && ageDay < 0)){
    age = parseInt(age) - 1;
console.log(age);
  }
    if(age <18) {
        bfToggleFields('on','element','legalguardian',bfDeactivateField);
    }
   else if(age >= 18)  {
        bfToggleFields('off','element','legalguardian',bfDeactivateField);
    }

}
Please change that and let me know whether that resolves the issue.

If it doesn't I will send you a package with my form.

Regards,

Mihaela
The following user(s) said Thank You: multiweb

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

Conditional Field If Less than 18 Years Old 1 year 2 months ago #236301

  • Topic Author
  • multiweb
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 15
  • Thanks: 0
Good eye!

That works perfectly, thank you very much for your help and perseverance!

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

Conditional Field If Less than 18 Years Old 1 year 2 months ago #236303

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 414
Thank you for your kind words.

I'm glad that I've helped and that this is now working for you. :)

Best regards,

Mihaela

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

Moderators: ForumSupport
Time to create page: 0.043 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

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!