[Skip to main content](#vessel-content)

#   Force Custom Text field to uppercase

##

- **[nevillematthews](/forum/user/39340-nevillematthews "View nevillematthews's Profile")**
- [![nevillematthews's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/39340-nevillematthews "View nevillematthews's Profile") Topic Author
- [ Offline](/forum/user/39340-nevillematthews)

Less More

- Posts: 31
- Thank you received: 1
-
-
- [](https://www.matcom.co.uk)
-

6 years 1 month ago [\#324457](#324457) by [nevillematthews](/forum/user/39340-nevillematthews "View nevillematthews's Profile")  *[Force Custom Text field to uppercase](/forum/32-content-creation/900907-force-custom-text-field-to-uppercase#324457 "-- url of the page with the problem -- :   www.mathost3.co.uk/lou4  -- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.1 -- PHP version -- : 7.3.21 -- Browser(s) name and version -- : Firefox Developer 82.0b5(64-bit)  Hi  How do I force a Custom Text field to uppercase?  I don't really want to use Regex as this only reports an error, I would like the field to just save to uppercase but preferably only show upper case when typing.  Thank you  Neville Matthews")* was created by *[nevillematthews](/forum/user/39340-nevillematthews "View nevillematthews's Profile")*

-- url of the page with the problem -- : [ www.mathost3.co.uk/lou4](http://www.mathost3.co.uk/lou4)
-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.1
-- PHP version -- : 7.3.21
-- Browser(s) name and version -- : Firefox Developer 82.0b5(64-bit)

Hi

How do I force a Custom Text field to uppercase?

I don't really want to use Regex as this only reports an error, I would like the field to just save to uppercase but preferably only show upper case when typing.

Thank you

Neville Matthews

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTAwOTA3LWZvcmNlLWN1c3RvbS10ZXh0LWZpZWxkLXRvLXVwcGVyY2FzZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

6 years 1 month ago [\#324470](#324470) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Force Custom Text field to uppercase](/forum/32-content-creation/900907-force-custom-text-field-to-uppercase#324470 "-- url of the page with the problem -- :   www.mathost3.co.uk/lou4  -- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.1 -- PHP version -- : 7.3.21 -- Browser(s) name and version -- : Firefox Developer 82.0b5(64-bit)  Hi  How do I force a Custom Text field to uppercase?  I don't really want to use Regex as this only reports an error, I would like the field to just save to uppercase but preferably only show upper case when typing.  Thank you  Neville Matthews")*

Hi,

You can add CSS code for that using text-transform: uppercase; on the input field so that the text appears uppercase in the input field.
Now with that, the text will appear uppercase in the input but won't be saved as uppercase.
You would need to also either:
- add a similar CSS to the area where the value is used to have it appear as uppercase
- add some javascript to the page where you have the input to force the uppercase while the text is being typed

Now a simpler approach would be to force uppercase with the pattern attribute in your custom field:
pattern="[A-Z]*"

Here is a page which discuss the different solutions:
[ www.the-art-of-web.com/html/input-field-uppercase/](https://www.the-art-of-web.com/html/input-field-uppercase/)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTAwOTA3LWZvcmNlLWN1c3RvbS10ZXh0LWZpZWxkLXRvLXVwcGVyY2FzZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nevillematthews](/forum/user/39340-nevillematthews "View nevillematthews's Profile")**
- [![nevillematthews's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/39340-nevillematthews "View nevillematthews's Profile") Topic Author
- [ Offline](/forum/user/39340-nevillematthews)

Less More

- Posts: 31
- Thank you received: 1
-
-
- [](https://www.matcom.co.uk)
-

6 years 4 weeks ago [\#325152](#325152) by [nevillematthews](/forum/user/39340-nevillematthews "View nevillematthews's Profile")  Replied by *[nevillematthews](/forum/user/39340-nevillematthews "View nevillematthews's Profile")* on topic *[Force Custom Text field to uppercase](/forum/32-content-creation/900907-force-custom-text-field-to-uppercase#325152 "-- url of the page with the problem -- :   www.mathost3.co.uk/lou4  -- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.1 -- PHP version -- : 7.3.21 -- Browser(s) name and version -- : Firefox Developer 82.0b5(64-bit)  Hi  How do I force a Custom Text field to uppercase?  I don't really want to use Regex as this only reports an error, I would like the field to just save to uppercase but preferably only show upper case when typing.  Thank you  Neville Matthews")*

Hi Nicolas

when I enter exactly this --&gt; pattern="[A-Z]*" including the quotes in the Custom Field "Attributes" field and try to save it I get the following error message:-

Error Saving
Please specify a correct attribute

Thank you

Neville Matthews

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTAwOTA3LWZvcmNlLWN1c3RvbS10ZXh0LWZpZWxkLXRvLXVwcGVyY2FzZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

6 years 4 weeks ago [\#325154](#325154) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Force Custom Text field to uppercase](/forum/32-content-creation/900907-force-custom-text-field-to-uppercase#325154 "-- url of the page with the problem -- :   www.mathost3.co.uk/lou4  -- HikaShop version -- : 4.4.0 -- Joomla version -- : 3.9.1 -- PHP version -- : 7.3.21 -- Browser(s) name and version -- : Firefox Developer 82.0b5(64-bit)  Hi  How do I force a Custom Text field to uppercase?  I don't really want to use Regex as this only reports an error, I would like the field to just save to uppercase but preferably only show upper case when typing.  Thank you  Neville Matthews")*

Hi,

I think that the issue is that the star character has not been authorized.
Change the line: Code:

if(!preg_match('#^([a-z0-9_-]+ *= *"[\p{L}\p{N}\p{Z}\p{S}\p{M} :\-;\(\)\{\}\[\]\']+" *)* *$#i', $fieldOptions['attribute'])){

to: Code:

if(!preg_match('#^([a-z0-9_-]+ *= *"[\p{L}\p{N}\p{Z}\p{S}\p{M} \+\*:\-;\(\)\{\}\[\]\']+" *)* *$#i', $fieldOptions['attribute'])){

in the file administrator/components/com_hikashop/classes/field.php and try again. It should let you do it then.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTAwOTA3LWZvcmNlLWN1c3RvbS10ZXh0LWZpZWxkLXRvLXVwcGVyY2FzZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.052 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
