[Skip to main content](#vessel-content)

#   Age Limit?

##

- **[twhcreations](/forum/user/3186-twhcreations "View twhcreations's Profile")**
- [![twhcreations's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3186.png)](/forum/user/3186-twhcreations "View twhcreations's Profile") Topic Author
- [ Offline](/forum/user/3186-twhcreations)

Less More

- Posts: 127
- Thank you received: 8
-
-
- [](http://www.webtechplus.com.au)
-

14 years 11 months ago [\#33503](#33503) by [twhcreations](/forum/user/3186-twhcreations "View twhcreations's Profile")  *[Age Limit?](/forum/4-how-to/33503-age-limit#33503 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")* was created by *[twhcreations](/forum/user/3186-twhcreations "View twhcreations's Profile")*

I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.

Does anyone know how this could be done?
[ mcgrathwines.com.au/index.php/online-shop](http://mcgrathwines.com.au/index.php/online-shop)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

14 years 11 months ago [\#33529](#33529) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#33529 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

Hi,

You can create custom fields via the menu Display-&gt;Custom fields to ask more information to your customers.
If you create custom fields of the table "order", it will display on the checkout as additional information.
If it's of the table "address", it will be in the address form. If it's of the table "user", it will be as user information.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[twhcreations](/forum/user/3186-twhcreations "View twhcreations's Profile")**
- [![twhcreations's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar3186.png)](/forum/user/3186-twhcreations "View twhcreations's Profile") Topic Author
- [ Offline](/forum/user/3186-twhcreations)

Less More

- Posts: 127
- Thank you received: 8
-
-
- [](http://www.webtechplus.com.au)
-

14 years 10 months ago [\#35617](#35617) by [twhcreations](/forum/user/3186-twhcreations "View twhcreations's Profile")  Replied by *[twhcreations](/forum/user/3186-twhcreations "View twhcreations's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#35617 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

Is there an easy way to question this entry and confirm that the age entered is over 18 years of age?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

14 years 10 months ago -  14 years 10 months ago [\#35639](#35639) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#35639 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

You could do that by adding some javascript in the file "registration" of the view "user" via the menu Display-&gt;Views.
Suppose that your custom field is called "user_age", you would have that: Code:

JHTML::_('behavior.mootools'); $script=' window.addEvent(\'domready\', function() { $(\'user_age\').addEvent(\'change\',function(){ if(parseInt(this.value)&lt;19){ alert(\'You must be over 18 years old\'); this.value = \'\'; } }); }); '; $doc =&amp; JFactory::getDocument(); $doc-&gt;addScriptDeclaration($script);

Last edit: 14 years 10 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")**
- [![Taz&#95;1999's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")
- [ Offline](/forum/user/9424-taz-1999)

Less More

- Posts: 20
- Thank you received: 2
-
-

14 years 2 months ago -  14 years 2 months ago [\#65096](#65096) by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")  Replied by *[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65096 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

I'm having trouble figuring out where in the file I should place this. Could someone help me?

(It's not at the end of the file anyways, just tried that.) ![:)](/media/kunena/emoticons/3.png ":)")

Last edit: 14 years 2 months ago by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

14 years 2 months ago [\#65098](#65098) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65098 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

It should be added after the first &lt;?php tag of the file.

The following user(s) said Thank You: [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")**
- [![Taz&#95;1999's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")
- [ Offline](/forum/user/9424-taz-1999)

Less More

- Posts: 20
- Thank you received: 2
-
-

14 years 2 months ago -  14 years 2 months ago [\#65111](#65111) by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")  Replied by *[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65111 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

Is this correct, I seem to be able to register a user three years old.

[ ![visningar.jpg](/forum/attachment/5694) ](/forum/attachment/5694 "visningar.jpg")

[ ![fields.jpg](/forum/attachment/5695) ](/forum/attachment/5695 "fields.jpg")

Added this image too:

[ ![birthday&#95;field.jpg](/forum/attachment/5697) ](/forum/attachment/5697 "...hday&#95;field.jpg")

This became a textfield?

- [ ![visningar.jpg](/forum/attachment/5694) ](/forum/attachment/5694 "visningar.jpg") [ ](/forum/attachment/5694?download=1 "visningar.jpg")
- [ ![fields.jpg](/forum/attachment/5695) ](/forum/attachment/5695 "fields.jpg") [ ](/forum/attachment/5695?download=1 "fields.jpg")
- [ ![birthday&#95;field.jpg](/forum/attachment/5697) ](/forum/attachment/5697 "...hday&#95;field.jpg") [ ](/forum/attachment/5697?download=1 "...hday&#95;field.jpg")

Last edit: 14 years 2 months ago by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

14 years 2 months ago [\#65267](#65267) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65267 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

It sounds correct yes.

Could you give a link to that so that we can see what you have ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")**
- [![Taz&#95;1999's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")
- [ Offline](/forum/user/9424-taz-1999)

Less More

- Posts: 20
- Thank you received: 2
-
-

14 years 2 months ago [\#65462](#65462) by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")  Replied by *[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65462 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

Sorry no link. It's not open to the public yet.

Still doesn't work. Don't know why.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")**
- [![Taz&#95;1999's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")
- [ Offline](/forum/user/9424-taz-1999)

Less More

- Posts: 20
- Thank you received: 2
-
-

14 years 2 months ago -  14 years 2 months ago [\#65466](#65466) by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")  Replied by *[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65466 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

Two more pictures, the registration field with the date field, and the date I'm using to register. (The screenshot only shows this date filled in the form but before I go on I fill in all fields correctly, all of it). There are no errors on submit, I get: Thank you for registring and a confirmation email to the mail adress I used.

Also a screenshot of inside edit fields. I changed "Only old dates" and set it to "All dates"/"Alla datum".

[ ![date.jpg](/forum/attachment/5745) ](/forum/attachment/5745 "date.jpg")

[ ![birthday.jpg](/forum/attachment/5746) ](/forum/attachment/5746 "birthday.jpg")

- [ ![date.jpg](/forum/attachment/5745) ](/forum/attachment/5745 "date.jpg") [ ](/forum/attachment/5745?download=1 "date.jpg")
- [ ![birthday.jpg](/forum/attachment/5746) ](/forum/attachment/5746 "birthday.jpg") [ ](/forum/attachment/5746?download=1 "birthday.jpg")

Last edit: 14 years 2 months ago by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")**
- [![Taz&#95;1999's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")
- [ Offline](/forum/user/9424-taz-1999)

Less More

- Posts: 20
- Thank you received: 2
-
-

14 years 2 months ago -  14 years 2 months ago [\#65472](#65472) by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")  Replied by *[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65472 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

Also, in Sweden you write your Personal identity number as:

YYYYMMDD-NNNZ

The Z is a checkssumnumber.

What codechanges would I need to do to convert YYYYMMDD to a regular date and then use that date to check the age limit?

I would also change the field length to 13 and the name to user_personal_identity_number and the type to text.

Last edit: 14 years 2 months ago by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86583
- Thank you received: 14324
-
-

14 years 2 months ago [\#65631](#65631) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65631 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

We would need to look at the HTML/javascript of your page with firebug in order to say what could be wrong with your changes as what you showed so far is ok.
That's why I asked for a link. A screenshot won't do.

But I think you didn't understand the initial messages of that thread.
You have to create a custom field of the type "dropdown" with the age of the person, not with the birthday. Otherwise, the javascript I gave you won't work.

You can't change the name field column name. You can however create a new field with that column name and unpublish the default name field.

If you want to check the age based on the personal identidy number, that will require more complex javascript.
You would have first to cut the string and then compare the year.

This is already far outside regular support, I would recommend that you seek the help of a developer if you want to do these customization or stick with the initial customization of having a dropdown where the user select his age.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")**
- [![Taz&#95;1999's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")
- [ Offline](/forum/user/9424-taz-1999)

Less More

- Posts: 20
- Thank you received: 2
-
-

14 years 2 months ago [\#65634](#65634) by [Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")  Replied by *[Taz\_1999](/forum/user/9424-taz-1999 "View Taz&#95;1999's Profile")* on topic *[Re: Age Limit?](/forum/4-how-to/33503-age-limit#65634 "I have a project i am working on, its for a winery to sell online they must record the clients age and record it against the sale.  Does anyone know how this could be done?   mcgrathwines.com.au/index.php/online-shop")*

You are correct in everything. I missed a part in the original thread that the field was not a date field it was supposed to be a number, selectable in a menu.

When I tried entering just 18 in the field instead of 2010-12-20 (which is way larger than 19), then I got the expected behaviour. So it works as advertised, even with a text field instead of a menu. ![:)](/media/kunena/emoticons/3.png ":)")

I also understand about the limits of regular support, and would like to say thank you for the help! I will ask a friend with the rest. Maybe that will result in some code I can post here for others with the same problem.

The following user(s) said Thank You: [nicolas](/forum/user/63-nicolas "View nicolas's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzMzNTAzLWFnZS1saW1pdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.094 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
