Validation not required custom field

  • Posts: 382
  • Thank you received: 77
8 years 11 months ago #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

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 11 months ago #224862

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 or Create an account to join the conversation.

  • Posts: 382
  • Thank you received: 77
8 years 11 months ago #224941

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 or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 11 months ago #224966

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 & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum