Calcul d'âge

  • jchermant
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 37
  • Thank you received: 0

jchermant created the topic: Calcul d'âge

Je souhaite mettre en place un champ dans un formulaire de breezingforms_lite qui donnerait l'âge d'un individu à partir de sa date de naissance.
J'ai créé un champ "date" où je dispose de la date du jour,
J'ai créé un champ "dateanniversaire" où j'entre une date d'anniversaire.
J'ai créé un champ ""age" où je souhaite trouver l'âge de l'individu.
J'ai écrit ce script au niveau du champ "age" :
function ff_age_action(element, action)
ff_getElementByName('age').value =0;
ff_getElementByName('age').value =
function CalculAge()
var today = Number(ff_getElementByName('date').value);
var dtn=document.getElementById('datenaissance').value; // on lit la date de naissance
var an=dtn.substr(6,4); // l'année (les quatre premiers caractères de la chaîne à partir de 6)
var mois=dtn.substr(3,2);// On selectionne le mois de la date de naissance
var day= dtn.substr(0,2); // On selectionne la jour de la date de naissance

var datenaissance = new Date(an + "/" + mois + "/" + day);

var age = today.getFullYear() - dateNaissance.getFullYear();
var m = today.getMonth() - dateNaissance.getMonth();
if (m < 0 || (m === 0 && today.getDate() < dateNaissance.getDate())) {
age = age - 1;

document.getElementById('age').value = age; // que l'on place dans le input d'id Age
// ff_age_action

Mon problème est que le champ "date" ne permet pas d'ajouter du script.
Pouvez-vous m'aider ou est-ce tout simplement impossible ?
Merci de votre aide
  • Posts: 2365
  • Karma: 85
  • Thank you received: 317

mihaela replied the topic: Calcul d'âge


Can you please explain the issue in English?


Moderators: ForumSupporttomeperica
Time to create page: 0.054 seconds

Live Support Chat Opened!

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

Summer Sale!

50% discount on all of our extension subscription plans & templates!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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 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 to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here