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

#   Validation not required custom field

##

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

Less More

- Posts: 382
- Thank you received: 77
-
-
-
-

10 years 10 months ago [\#224815](#224815) by [almika](/forum/user/15732-almika "View almika's Profile")  *[Validation not required custom field](/forum/2-general-talk-about-hikashop/881219-validation-not-required-custom-field#224815 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.6  Hi!  I can't get a solution after looking this forum. I need your advice.  I have an user custom field (text type) for the Hikashop registration form. It is not required, it may be empty. But, if it is not empty I want to validate it.  I wrote regexp for it, but now regexp validation has not effect for not required custom field.  What can I do to resolve my issue?  Thank you")* was created by *[almika](/forum/user/15732-almika "View almika's Profile")*

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.6

Hi!

I can't get a solution after looking this forum. I need your advice.

I have an user custom field (text type) for the Hikashop registration form. It is not required, it may be empty.
But, if it is not empty I want to validate it.

I wrote regexp for it, but now regexp validation has not effect for not required custom field.

What can I do to resolve my issue?

Thank you

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg4MTIxOS12YWxpZGF0aW9uLW5vdC1yZXF1aXJlZC1jdXN0b20tZmllbGQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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: 86322
- Thank you received: 14281
-
-

10 years 10 months ago [\#224862](#224862) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Validation not required custom field](/forum/2-general-talk-about-hikashop/881219-validation-not-required-custom-field#224862 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.6  Hi!  I can't get a solution after looking this forum. I need your advice.  I have an user custom field (text type) for the Hikashop registration form. It is not required, it may be empty. But, if it is not empty I want to validate it.  I wrote regexp for it, but now regexp validation has not effect for not required custom field.  What can I do to resolve my issue?  Thank you")*

Hi,

Ah yes, the regex check is only usable if the field is required due to the way the system is made.
The simplest would be to create a first custom field with a yes/no choice and have the second field's "display limited to" option set to only display if the first field is set to yes.
That way, the user can say if he wants to fill the second field or not thanks to the first field and that way the regex on the second field would only apply if the yes choice would be selected in the first field.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg4MTIxOS12YWxpZGF0aW9uLW5vdC1yZXF1aXJlZC1jdXN0b20tZmllbGQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 382
- Thank you received: 77
-
-
-
-

10 years 10 months ago [\#224941](#224941) by [almika](/forum/user/15732-almika "View almika's Profile")  Replied by *[almika](/forum/user/15732-almika "View almika's Profile")* on topic *[Validation not required custom field](/forum/2-general-talk-about-hikashop/881219-validation-not-required-custom-field#224941 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.6  Hi!  I can't get a solution after looking this forum. I need your advice.  I have an user custom field (text type) for the Hikashop registration form. It is not required, it may be empty. But, if it is not empty I want to validate it.  I wrote regexp for it, but now regexp validation has not effect for not required custom field.  What can I do to resolve my issue?  Thank you")*

Thank you, **nicolas**

But it's not fit to me.

I want to do simple "honey pot", it is more friendly for users than captcha.

I think it will be good to do validation for not required fields, if the regexp exists for it.

What's the file I have to edit?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg4MTIxOS12YWxpZGF0aW9uLW5vdC1yZXF1aXJlZC1jdXN0b20tZmllbGQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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)
-

10 years 10 months ago [\#224966](#224966) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Validation not required custom field](/forum/2-general-talk-about-hikashop/881219-validation-not-required-custom-field#224966 "-- HikaShop version -- : 2.6.0 -- Joomla version -- : 3.4.6  Hi!  I can't get a solution after looking this forum. I need your advice.  I have an user custom field (text type) for the Hikashop registration form. It is not required, it may be empty. But, if it is not empty I want to validate it.  I wrote regexp for it, but now regexp validation has not effect for not required custom field.  What can I do to resolve my issue?  Thank you")*

Hi,

The file to edit is the HikaShop field class
"administrator/components/com_hikashop/classes/field.php".

But I have to warn you that this file is a core file ; which means that you will loose your modification when you will update HikaShop.

Regards,

---

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzg4MTIxOS12YWxpZGF0aW9uLW5vdC1yZXF1aXJlZC1jdXN0b20tZmllbGQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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.072 seconds

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