the custom field for inquiry form failed to submmit

  • Posts: 42
  • Thank you received: 0
1 year 3 months ago #348149

-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.4
-- PHP version -- : 5.6.40
-- Browser(s) name and version -- : chrome
-- Error-message(debug-mod must be tuned on) -- : no error message on the page.

Hello
I have installed hikashop business on a client's website for many years and It has been working well from the begining.

but recently my client found that when sending inquiry after submitting the form, there is a message "ERROR please complete the model field', and another message "please enter a valid email address".

The model field is configured by custom field for customers to know what machine model they inquiry, that is alway work well and the email field I filled is correctly match the email form such like "This email address is being protected from spambots. You need JavaScript enabled to view it.".

I do not know why it shows the error message.

You can test it on my website and you can know what I said.



Please hlep me to solve this issue, thank you.

Attachments:

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

  • Posts: 81513
  • Thank you received: 13068
  • MODERATOR
1 year 3 months ago #348157

Hi,

The "please enter a valid email address" is I think a byproduct of the model field outputting an error message. When at least a field is not provided properly, the data returned will be empty in the code, resulting in the email address not being found. We'll add a check so that it doesn't output an error message for the email in such cases.

So I think the only issue is with the Model custom field. Could you provide a screenshot of the settings of the Model custom field ?
I think you might have an issue with how you configured it.

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

  • Posts: 42
  • Thank you received: 0
1 year 3 months ago #348158

OK, I will provide.

I create field called "Model" for every products, for example "TINY-28".



I use this field for contact table and give it a default value "TINY-28".
the attachment cf2 1


for frontend to display the product name matching the product for inquiry.
the attachment cf2 2


this field is specified for exactly TINY-28 the product.
the attachment cf2 3


In the begining, I have used such method for many years, I do not know how it become un-functionable.

Attachments:
Last edit: 1 year 3 months ago by cycnorman.

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

  • Posts: 81513
  • Thank you received: 13068
  • MODERATOR
1 year 3 months ago #348160

Hi,

I suppose you must have activated the "required" setting of the Model custom fields and that's what lead to the issue.
I checked the code and I think it doesn't handle the product restriction properly for custom contact fields on the submission of the form when the field is required.

Changing the code:

if(empty($formData['contact'])) {
			$formData['contact'] = @$formData['register'];
			foreach($formData['contact'] as $column => $value) {
				hikashop_secureField($column);
				$element->$column = strip_tags($value);
			}
		} else {
			$fieldsClass = hikashop_get('class.field');
			$element = $fieldsClass->getInput('contact', $element);
		}

to:
		if(empty($formData['contact'])) {
			$formData['contact'] = @$formData['register'];
		}
		if(!empty($formData['contact'])) {
			foreach($formData['contact'] as $column => $value) {
				hikashop_secureField($column);
				$element->$column = strip_tags($value);
			}
		}
		if(empty($formData['register'])) {
			$fieldsClass = hikashop_get('class.field');
			$element = $fieldsClass->getInput('contact', $element);
		}
in the file components/com_hikashop/controllers/product.php and it should help properly handle this case.

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

Time to create page: 0.090 seconds
Powered by Kunena Forum