Required checkout custom field only on step 4

  • Posts: 42
  • Thank you received: 1
9 years 1 month ago #218223

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.6.13
-- Browser(s) name and version -- : Firefox 40.0.3

Hi,

I have some checkout custom field and I want to show it only on step 4, it is a required field.
In my components/com_hikashop/views/checkout/tmpl/custom_fields.php override I have:

$showfields = array(
	'my_special_field4' => 4, // my_special_field4 display only on step 4
);
When I'm on step 2 and I'm trying to go to step 3, I'm getting alert which says that my "my_special_field4" is required and I must fill it. Of course "my_special_field4" is not visible on step 2, I can see in page source there's display:none and type="hidden" applied, but still javascript is looking for this field if it's filled or not (on step 2 I have also other checkout fields). How can I fix this?

Best regards,
Chris

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

  • Posts: 82909
  • Thank you received: 13379
  • MODERATOR
9 years 1 month ago #218228

Hi,

Splitting custom fields on several steps will only work if the fields are not required.
If you need to have them required, then it will require complex changes in the file administrator/components/com_hikashop/classes/field.php which handle the output of the js code to check the fields and also handle the server side check after the form is submitted. Both will have to be changed.

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

Time to create page: 0.054 seconds
Powered by Kunena Forum