[SOLVED] DOB and Age

8 years 11 months ago - 8 years 10 months ago #264709 by jpdenny1
[SOLVED] DOB and Age was created by jpdenny1
Hello.

May I have a solution and which will be a subsequent lesson for the following type of requirement:

A field is - Date of Birth, uses Type|Date etc. User enters their DOB, let's say in an 'Additional Info' tab.

How do I also have an Age field that draws the data from the DOB entry so it populates automatically after DOB is entered?Let's say this is hidden when empty and appears on the 'Contact Info' tab after DOB is entered.

Can that be done. I'm sure it can so I suppose I'm just wondering where the magic happens and what's the code. (What Type is this Age field also, I'm sure you'll mention it anyway)

Kind regards

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9

Please Log in to join the conversation.

8 years 11 months ago - 8 years 11 months ago #264720 by jpdenny1
Replied by jpdenny1 on topic DOB and Age
Same applies for a registration field that does not show on profile but the value of this field is used to automatically add a value to another field that will show on the profile

i.e. registration field is filled in - this has various functions namely assigning a usergroup through auto action

this value or field e.g. teacher or student, I want to separate from the original tab - so I can place it where ever I want e.g. one tab to the other but it automatically displays on profile view without a need to edit

Any ideas. A little bit lost here, I'm sure I could work around it but compromised alot already and wouldn't mind tackling this one, with some guidance

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9

Please Log in to join the conversation.

8 years 11 months ago #264752 by krileon
Replied by krileon on topic DOB and Age
To have the storage on 1 tab, but the display on another you'd use a Custom HTML field to substitute in its display. The trick for a date field displaying as age though is you need to use the formatted substitution and not the raw substitution. So you need to use the following usage.

[cb:userfield field="FIELD_NAME" /]

More on substitution usage can be found in the below tutorial. Note your field needs to be set to display on profile for the substitution to work, but it can be on a tab in a not shown on profile position.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 10 months ago #264780 by jpdenny1
Replied by jpdenny1 on topic DOB and Age
Ah ok, the Substitution article is a little intimidating but your advice made it more clear, giving a confidence to try it.

So I didn't get the substitution for Age on the back of the DOB but I was able to put Birthday which works and fits the purpose - kind of - would be better to have the age right there in front of you instead of having to calculate it.

I can now use basic substitutions, thanks!

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9

Please Log in to join the conversation.

8 years 10 months ago #264784 by krileon
Replied by krileon on topic DOB and Age
Custom HTML field can show the age in backend as well I suppose if you enable its edit display. Edit display of date or datetime fields don't show their calculated value though, but you could probably substitute it into the profile edit value layout under Parameters > Layout (e.g. [value] [cb:userfield field="FIELD_NAME" /]).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

8 years 10 months ago #264802 by jpdenny1
Replied by jpdenny1 on topic DOB and Age
Thanks Kyle, suppose it's one of these where I'll convince myself that Birthday with a date opposite it, on a profile - is actually better than showing Age. It is probably better though from certain viewpoints!Tried and failed with the whole Age pulling form DOB database.

Thanks for your time

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.224 seconds