Page 3 of 3
Re: "Feedback" and "Ask a question" do not work.
Posted: 27 Sep 2022, 22:52
by Jan
So the situation in fact means, that for now it is possible to render tel form field in Phoca Cart including pattern, but Joomla does not render it.
Will be great if you can test this PR:
https://github.com/joomla/joomla-cms/pull/38852
In fact it means, open:
layouts/joomla/form/field/tel.php
And add following code (line cca 62)
FROM:
Code: Select all
$required ? 'required' : '',
$dataAttribute,
TO:
Code: Select all
$required ? 'required' : '',
!empty($pattern) ? 'pattern="' . $pattern . '"' : '',
$dataAttribute,
Then if you fill the phone field in Phoca Cart:
- pattern and validate: tel, then the form field becomes tel and the validation works
Jan
Re: "Feedback" and "Ask a question" do not work.
Posted: 28 Sep 2022, 15:14
by kosh2323
Hi Jan. On your advice, I tried the "phone" field for the input specified in the pattern, but only in the user profile form, yes it works. But in the form of "Ask a question" - a menu item, or "Ask a question about a product", these fields of these forms are still not checked.
Re: "Feedback" and "Ask a question" do not work.
Posted: 28 Sep 2022, 15:51
by Jan
Hi, if I change this XML:
components/com_phocacart/models/forms/question.xml
FROM:
Code: Select all
<field name="phone" type="text" class="form-control" size="40" label="COM_PHOCACART_FIELD_F_PHONE_LABEL" description="COM_PHOCACART_FIELD_F_PHONE_DESC" filter="string" />
TO:
Code: Select all
<field name="phone" type="tel" class="form-control" size="40" label="COM_PHOCACART_FIELD_F_PHONE_LABEL" description="COM_PHOCACART_FIELD_F_PHONE_DESC" filter="string" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" />
Then it works OK for me
Jan
Re: "Feedback" and "Ask a question" do not work.
Posted: 28 Sep 2022, 19:59
by kosh2323
Checked 3 times it doesn't work.
I'm sorry, I figured it out, tested it after upgrading to 4.2.3, and after updating Joomla overwritten its files, including tel.php , and I see the old
Code: Select all
$required ? 'required' : '',
$dataAttribute,
in it and if I change it
Code: Select all
$required ? 'required' : '',
!empty($pattern) ? 'pattern="' . $pattern . '"' : '',
$dataAttribute,
to the new version, then everything works, thank you. Only now it turns out that with each update it will need to be changed again.
Re: "Feedback" and "Ask a question" do not work.
Posted: 29 Sep 2022, 14:29
by kosh2323
It would be nice to also enter explanations under the fields themselves for users, explaining the correctness of the input, for example, "enter the phone number in the format 123-123-1234". And it is even better to adjust and configure these fields in the admin panel in the "Questions" section. Since there is a field setting during registration, delivery, in the user profile, but there is no field setting when asking questions. And this is also important. There are separate settings in the "settings", you can attach an article to the explanation, but there is no field to explain the correctness of the input under the field, there is also no placeholder.
Re: "Feedback" and "Ask a question" do not work.
Posted: 29 Sep 2022, 17:23
by Jan
Hi, usualy when adding the phone number, nobody cares about the format because it can be different, some people add it with or without prefix, etc. etc. This is why mostly there is text field and any value is accepted (without prefix, with prefix, without spaces, with spaces, three numbers next to each other or two numbers next to each other, etc. - the goal is not to burden user with adding right format but to get the telephone contact from him in any form)
The phone form field:
<field name="phone" type="text" class="form-control" size="40" label="COM_PHOCACART_FIELD_F_PHONE_LABEL" description="COM_PHOCACART_FIELD_F_PHONE_DESC" filter="string" />
includes description so such description can be used, when override of the form is made.
So there, e.g. per language override you can write each instruction so user is able to see what format to add into the form.
Jan
Re: "Feedback" and "Ask a question" do not work.
Posted: 29 Sep 2022, 18:29
by kosh2323
Again, this field
is shown only if the user registers, but in the feedback form, or "Ask a question about the product" it is not shown at all, right?
Re: "Feedback" and "Ask a question" do not work.
Posted: 03 Oct 2022, 23:41
by Jan
Hi, as default, it is not displayed in frontend.