Skip to main content

Validation on required custom fields

10 years 5 months ago #243606 by stuart@steedman.co.za
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.5.1
-- PHP version -- : 5.6.15
-- Browser(s) name and version -- : Firefox 47.0
-- Error-message(debug-mod must be tuned on) -- : Validation enqueue messages

We have a few custom fields that are required, under the Order type. They are all assigned to different Categories and do show up correctly according to the different products in your cart.
  • Wine Collection Date (Wine Category) - Required
  • Platters Collection Date (Platters Category) - Required

But, when one only has Wine products in your cart for instance, and importantly you disable Javascript in your browser and then submit, Hikashop comes back and tells you to please select a "Platters Collection Date", but this custom field isn't even visible on the checkout form. So we were forced to make all our custom fields NOT required and add our own Javascript validation on top with overrides. But for people that don't have Javascript enabled, those fields don't validate client side and Hikashop will then allow empty submits.

We did uopgrade Hikashop to the latest version (2.6.3), but this issue still persisted.

Does anyone know of a fix for this?

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

10 years 5 months ago - 10 years 5 months ago #243811 by Philip
Hello,

Can you provide a screenshot of your two Custom field back end configuration ?
Because, from what I know I don't see where the issue come from.

Awaiting news from you.

Regards
Last edit: 10 years 5 months ago by Philip.

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

10 years 5 months ago #244052 by stuart@steedman.co.za
Hi, here are two screenshots.

http://i.imgur.com/KPj65vj.png?1
http://i.imgur.com/7KQYSAn.png?1

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

10 years 4 months ago #244059 by nicolas
Hi,

I found the issue.
Add the code:
Code:
if(is_null($oldData)) $oldData = new stdClass(); $cart = $this->initCart(); $oldData->products = $cart->products;
before the code:
Code:
$orderData = $fieldClass->getInput('order',$oldData,!$this->cart_update);
in the file components/com_hikashop/controllers/checkout.php and that should fix the problem.

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

10 years 4 months ago #244205 by stuart@steedman.co.za
Awesome, thank you, that did the trick.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum