Calcul d'âge

  • jchermant
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 0

jchermant created the topic: Calcul d'âge

Bonjour,
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
#235350
  • Posts: 2109
  • Karma: 72
  • Thank you received: 267

mihaela replied the topic: Calcul d'âge

Hello,

Can you please explain the issue in English?

Regards,

Mihaela
#235378
Moderators: ForumSupporttomeperica
Time to create page: 0.057 seconds

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

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€

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 sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

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