margarizaldi
New Member
Hi guys, I need your little help in making some age classifications based on birthday element input. To be honest, I'm not a programmer, so I'm confused to write the codes.
I have a birthday field using d.o.b element (`table___dob`), just under this element I have a calc element (`table___age_category`) which is needed to run a simple operation as follows:
- When the user's birthday is between 1 december 2000 and 30 nov 2004 this element should return 'Category A'
- When the birthday is between 1 dec 1977 and 30 nov 2000, it returns 'Category B'
- When the birthday is between 1 dec 1967 and 30 nov 1977, it returns 'Category C'
- Else is 'Not available'
I have tried to use:
With ajax calculation = yes
and ajax observe fields is {table___dob}
The result is not reliable, sometimes it's correct and sometimes is not. I think I know that the only problem is on my knowledge in php.
Regards.
I have a birthday field using d.o.b element (`table___dob`), just under this element I have a calc element (`table___age_category`) which is needed to run a simple operation as follows:
- When the user's birthday is between 1 december 2000 and 30 nov 2004 this element should return 'Category A'
- When the birthday is between 1 dec 1977 and 30 nov 2000, it returns 'Category B'
- When the birthday is between 1 dec 1967 and 30 nov 1977, it returns 'Category C'
- Else is 'Not available'
I have tried to use:
PHP:
if ('{table___dob}' >= '2000-12-01' and '{table___dob}' <= '2004-11-30') {return 'Category A';}
...
...
else
{return 'Not Available';}
and ajax observe fields is {table___dob}
The result is not reliable, sometimes it's correct and sometimes is not. I think I know that the only problem is on my knowledge in php.
Regards.
Last edited: