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

#   Item custom field validation

##

- **[designbuilder](/forum/user/36129-designbuilder "View designbuilder's Profile")**
- [![designbuilder's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36129-designbuilder "View designbuilder's Profile") Topic Author
- [ Offline](/forum/user/36129-designbuilder)

Less More

- Posts: 9
- Thank you received: 0
-
-

11 years 4 months ago [\#204248](#204248) by [designbuilder](/forum/user/36129-designbuilder "View designbuilder's Profile")  *[Item custom field validation](/forum/25-install-update/877417-item-custom-field-validation#204248 "-- HikaShop version -- : 4.2 -- Joomla version -- : 3.4  I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks")* was created by *[designbuilder](/forum/user/36129-designbuilder "View designbuilder's Profile")*

-- HikaShop version -- : 4.2
-- Joomla version -- : 3.4

I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks

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

- **[gpraceman](/forum/user/37240-gpraceman "View gpraceman's Profile")**
- [![gpraceman's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37240.png)](/forum/user/37240-gpraceman "View gpraceman's Profile")
- [ Offline](/forum/user/37240-gpraceman)

Less More

- Posts: 166
- Thank you received: 11
-
- [](http://grandprix-software-central.com)
-

11 years 4 months ago -  11 years 4 months ago [\#204257](#204257) by [gpraceman](/forum/user/37240-gpraceman "View gpraceman's Profile")  Replied by *[gpraceman](/forum/user/37240-gpraceman "View gpraceman's Profile")* on topic *[Item custom field validation](/forum/25-install-update/877417-item-custom-field-validation#204257 "-- HikaShop version -- : 4.2 -- Joomla version -- : 3.4  I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks")*

From what I have seen, the only validation that you can currently do is whether it is required or not. I earlier recommended that they add in the ability to do a Regex validation on a custom filed. To do a database validation would be more involved, but you could request that feature be added.

I have customers that need to supply a serial number in order to purchase a software upgrade. I made a custom field for the applicable products and made it required, but the customer can enter whatever they want. We have to validate that serial number when we get the order. If they do add that feature, I would be interested in it. If they at least added a Regex validation, the customers couldn't just enter any old value.

Last edit: 11 years 4 months ago by [gpraceman](/forum/user/37240-gpraceman "View gpraceman's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NzQxNy1pdGVtLWN1c3RvbS1maWVsZC12YWxpZGF0aW9uP3RtcGw9bWFya2Rvd24=) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

11 years 4 months ago [\#204280](#204280) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Item custom field validation](/forum/25-install-update/877417-item-custom-field-validation#204280 "-- HikaShop version -- : 4.2 -- Joomla version -- : 3.4  I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks")*

Hi,

A regex validation for the custom fields has already been added to the latest version of HikaShop.
But if you want to validate against a database of valid values, as gpraceman said, it will require something more involved.
HikaShop has a lot of triggers which are listed on our developer documentation:
[ www.hikashop.com/support/support/documen...r-documentation.html](http://www.hikashop.com/support/support/documentation/62-hikashop-developer-documentation.html)
There, you'll find the triggers for the custom fields.
They allow you to create new types of custom fields via the development of a HikaShop plugin.
So you could create a new type of custom field, basing it on the standard text field type and overriding the check function to do your own check the way you want.
If you want a complete example, you can look at the advanced date picker plugin which is available in the folder plugins/hikashop/datepickerfield of your website.

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

- **[gpraceman](/forum/user/37240-gpraceman "View gpraceman's Profile")**
- [![gpraceman's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar37240.png)](/forum/user/37240-gpraceman "View gpraceman's Profile")
- [ Offline](/forum/user/37240-gpraceman)

Less More

- Posts: 166
- Thank you received: 11
-
- [](http://grandprix-software-central.com)
-

11 years 4 months ago [\#204303](#204303) by [gpraceman](/forum/user/37240-gpraceman "View gpraceman's Profile")  Replied by *[gpraceman](/forum/user/37240-gpraceman "View gpraceman's Profile")* on topic *[Item custom field validation](/forum/25-install-update/877417-item-custom-field-validation#204303 "-- HikaShop version -- : 4.2 -- Joomla version -- : 3.4  I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks")*

> nicolas wrote: A regex validation for the custom fields has already been added to the latest version of HikaShop.

Two weeks ago, [ you indicated](http://www.hikashop.com/forum/2-general-talk-about-hikashop/877156-custom-field-regex-validation.html) that you would look at adding such a feature. If that feature has already been added, where is it available? When I edit a custom field, I don't see any Regex option.

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

- **[designbuilder](/forum/user/36129-designbuilder "View designbuilder's Profile")**
- [![designbuilder's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/36129-designbuilder "View designbuilder's Profile") Topic Author
- [ Offline](/forum/user/36129-designbuilder)

Less More

- Posts: 9
- Thank you received: 0
-
-

11 years 4 months ago -  11 years 4 months ago [\#204331](#204331) by [designbuilder](/forum/user/36129-designbuilder "View designbuilder's Profile")  Replied by *[designbuilder](/forum/user/36129-designbuilder "View designbuilder's Profile")* on topic *[Item custom field validation](/forum/25-install-update/877417-item-custom-field-validation#204331 "-- HikaShop version -- : 4.2 -- Joomla version -- : 3.4  I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks")*

Nicolas thanks, creating a new custom field looks the way forward. I will have a look through the Datepickerfield example. It would be nice if there were some comments in these code suggestions.

gpraceman, it seems we are tying to solve the same requirement.

Last edit: 11 years 4 months ago by [designbuilder](/forum/user/36129-designbuilder "View designbuilder's Profile").

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

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

11 years 4 months ago [\#204404](#204404) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Item custom field validation](/forum/25-install-update/877417-item-custom-field-validation#204404 "-- HikaShop version -- : 4.2 -- Joomla version -- : 3.4  I have a custom field in the item table (text field) assigned to a product. Customers can enter an existing serial number on the product page. I would like to check that the serial number is valid, via a database query, before the product is added to the cart, or display an error if invalid. Can you advise suitable approach? Thanks")*

Hi,

> Two weeks ago, you indicated that you would look at adding such a feature. If that feature has already been added, where is it available? When I edit a custom field, I don't see any Regex option.

That's right. Two weeks ago as said that we would look into it, and we did.
We released the latest version yesterday and you can see that new feature mentioned on the change log of that new version:
[ www.hikashop.com/support/support/documen...ashop-changelog.html](http://www.hikashop.com/support/support/documentation/56-hikashop-changelog.html)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzg3NzQxNy1pdGVtLWN1c3RvbS1maWVsZC12YWxpZGF0aW9uP3RtcGw9bWFya2Rvd24=) 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.257 seconds

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

[](#top)
