Request: Allow HTML and punctuation in the “Attributes” field for custom fields

  • Posts: 615
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
2 days 23 hours ago #368905

-- 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:

uk-tooltip="title: example of content ;pos: right ;offset: 50"

But this does not work:
uk-tooltip="title: Hello! or one/two ;pos: right ;offset: 50"
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.

  • Posts: 84498
  • Thank you received: 13739
  • MODERATOR
2 days 18 hours ago #368909

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.

The following user(s) said Thank You: Lumiga

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

  • Posts: 615
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
2 days 18 hours ago #368914

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.


Kind regards,
Lumiga

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

  • Posts: 84498
  • Thank you received: 13739
  • MODERATOR
2 days 13 hours ago #368915

Hi,

it would also be great if this could work together with the tooltip from Regular Labs.

What do you mean by that ? You want to have Regular Labs tooltip tags inside UIKit tooltips ? I don't understand ?

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.

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".
This won't be a problem for updates or anything else.

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

  • Posts: 615
  • Thank you received: 23
  • Hikaserial Subscription Hikashop Multisite
2 days 39 minutes ago #368922

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.

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: 2 days 38 minutes ago by Lumiga.

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

  • Posts: 84498
  • Thank you received: 13739
  • MODERATOR
1 day 20 hours ago #368924

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:

<script>
var field = document.getElementById("xxx");
if(field) {
 field.addEventListener('input', function(){
  if(this.value>950)this.value=950;
 });
}
</script>
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.

The following user(s) said Thank You: Lumiga

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

Time to create page: 0.065 seconds
Powered by Kunena Forum