- Posts: 637
- Thank you received: 26
Request: Allow HTML and punctuation in the “Attributes” field for custom fields
11 months 2 weeks ago #368905
by Lumiga
Kind regards,
Lumiga
Request: Allow HTML and punctuation in the “Attributes” field for custom fields was created by Lumiga
-- HikaShop version -- : 6.1.0
-- Joomla version -- : 5.3.4
-- PHP version -- : 8.3
Hi HikaShop team,
We’d like to request an improvement to the “Attributes” field in HikaShop custom fields.
Currently, it’s not possible to use punctuation marks (like . or ,) or HTML tags within this field.
For example, the following works fine:
But this does not work:
Allowing punctuation and simple HTML would make it possible to create richer tooltips — for instance, to give users short explanations or hints about a field directly in the form.
This would be especially useful for YOOtheme Pro users, since it uses UIkit, which supports tooltips via the uk-tooltip attribute.
Thanks a lot for considering this feature enhancement!
Best regards,
Lumiga
-- Joomla version -- : 5.3.4
-- PHP version -- : 8.3
Hi HikaShop team,
We’d like to request an improvement to the “Attributes” field in HikaShop custom fields.
Currently, it’s not possible to use punctuation marks (like . or ,) or HTML tags within this field.
For example, the following works fine:
Code:
uk-tooltip="title: example of content ;pos: right ;offset: 50"
But this does not work:
Code:
uk-tooltip="title: Hello! or one/two ;pos: right ;offset: 50"
Code:
uk-tooltip="title: <strong>example of content.</strong> ;pos: right ;offset: 50"
Allowing punctuation and simple HTML would make it possible to create richer tooltips — for instance, to give users short explanations or hints about a field directly in the form.
This would be especially useful for YOOtheme Pro users, since it uses UIkit, which supports tooltips via the uk-tooltip attribute.
Thanks a lot for considering this feature enhancement!
Best regards,
Lumiga
Kind regards,
Lumiga
Please Log in or Create an account to join the conversation.
11 months 2 weeks ago #368909
by nicolas
Replied by nicolas on topic Request: Allow HTML and punctuation in the “Attributes” field for custom fields
Hi,
Thanks for your feedback on this. We'll be adding a patch for this in the next version of HikaShop which is to be released in a few weeks.
Thanks for your feedback on this. We'll be adding a patch for this in the next version of HikaShop which is to be released in a few weeks.
The following user(s) said Thank You: Lumiga
Please Log in or Create an account to join the conversation.
11 months 2 weeks ago #368914
by Lumiga
Kind regards,
Lumiga
Replied by Lumiga on topic Request: Allow HTML and punctuation in the “Attributes” field for custom fields
Thanks, it would also be great if this could work together with the tooltip from Regular Labs.
See here the configuration options..
docs.regularlabs.com/tooltips/getting-started/configuration
For the title field of a custom field, that already works. It would also be nice if that title field could be expanded to allow more characters, because right now you can’t fit longer sentences in it.
See here the configuration options..
docs.regularlabs.com/tooltips/getting-started/configuration
For the title field of a custom field, that already works. It would also be nice if that title field could be expanded to allow more characters, because right now you can’t fit longer sentences in it.
Kind regards,
Lumiga
Please Log in or Create an account to join the conversation.
11 months 2 weeks ago #368915
by nicolas
Replied by nicolas on topic Request: Allow HTML and punctuation in the “Attributes” field for custom fields
Hi,
This won't be a problem for updates or anything else.
What do you mean by that ? You want to have Regular Labs tooltip tags inside UIKit tooltips ? I don't understand ?it would also be great if this could work together with the tooltip from Regular Labs.
If you want more characters for the title of a custom field, go in your PHPMyAdmin, open the structure of the table hikashop_field and change the type of the field_realname column to "text" or event "longtext".For the title field of a custom field, that already works. It would also be nice if that title field could be expanded to allow more characters, because right now you can’t fit longer sentences in it.
This won't be a problem for updates or anything else.
Please Log in or Create an account to join the conversation.
11 months 2 weeks ago - 11 months 2 weeks ago #368922
by Lumiga
Kind regards,
Lumiga
Replied by Lumiga on topic Request: Allow HTML and punctuation in the “Attributes” field for custom fields
Forget that comment. It was more that I was deciding whether to use the one from YOOtheme or the one from RegularLabs. But the YOOtheme version works just fine.
I just noticed that I can’t add this attribute, but that’s probably been fixed in the new version as it also involves special characters.
This was meant to help the customer immediately to prevent when entering a value above 950 mm.
With the other regular expression option, the check only happens after submitting the form, but the Price Calculation plugin already calculates with values that shouldn’t be allowed, which makes it confusing.
That’s why I’d like to add this attribute earlier in the process, to prevent entering more than 950 mm.
And thanks for the idea to adjust the field length in the database.
I just noticed that I can’t add this attribute, but that’s probably been fixed in the new version as it also involves special characters.
Code:
oninput="if(this.value>950)this.value=950;"
This was meant to help the customer immediately to prevent when entering a value above 950 mm.
With the other regular expression option, the check only happens after submitting the form, but the Price Calculation plugin already calculates with values that shouldn’t be allowed, which makes it confusing.
That’s why I’d like to add this attribute earlier in the process, to prevent entering more than 950 mm.
And thanks for the idea to adjust the field length in the database.
Kind regards,
Lumiga
Last edit: 11 months 2 weeks ago by Lumiga.
Please Log in or Create an account to join the conversation.
11 months 2 weeks ago #368924
by nicolas
Replied by nicolas on topic Request: Allow HTML and punctuation in the “Attributes” field for custom fields
Hi,
Note that you don't need this to be added as an attribute. A cleaner way is to add it as javascript code in a view override.
For example in product / show_default.php you could add:
where xxx is the id of the input on the page.
There are several advantages to this:
- you don't need to use the attribute setting, so there are no restrictions to what you can do in it.
- having javascript code inside the database is not "clean". Code should ideally be in files. This way, you can also have coloration on the code to make it easier to write / maintain
- you can improve this code to add a notification box and potentially other things in the future more easily.
- if you have different fields for different products, you can have all the code in one place in that override instead of spreading it in different custom fields in the database. That way, if different fields require the same processing, they can use the same function and thus avoid cod duplication.
- using addEventListener instead of oninput, onchange etc is better because you can have several listeners on an input while you can only have one oninput and one onchange, etc attribute per HTML element.
- you don't need to wait for the patch in the next version.
Note that you don't need this to be added as an attribute. A cleaner way is to add it as javascript code in a view override.
For example in product / show_default.php you could add:
Code:
<script>
var field = document.getElementById("xxx");
if(field) {
field.addEventListener('input', function(){
if(this.value>950)this.value=950;
});
}
</script>
There are several advantages to this:
- you don't need to use the attribute setting, so there are no restrictions to what you can do in it.
- having javascript code inside the database is not "clean". Code should ideally be in files. This way, you can also have coloration on the code to make it easier to write / maintain
- you can improve this code to add a notification box and potentially other things in the future more easily.
- if you have different fields for different products, you can have all the code in one place in that override instead of spreading it in different custom fields in the database. That way, if different fields require the same processing, they can use the same function and thus avoid cod duplication.
- using addEventListener instead of oninput, onchange etc is better because you can have several listeners on an input while you can only have one oninput and one onchange, etc attribute per HTML element.
- you don't need to wait for the patch in the next version.
The following user(s) said Thank You: Lumiga
Please Log in or Create an account to join the conversation.
Time to create page: 0.226 seconds