- Posts: 42
- Thank you received: 0
Validating custom fields and showing message to user
9 years 2 months ago #274327
by Veli
Validating custom fields and showing message to user was created by Veli
-- HikaShop version -- : 3.1.1.
-- Joomla version -- : 3.7
-- PHP version -- : 7
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : none
Hi,
have made several custom fields and have seen it is possible to validate with for example [0-9] and this is working well. However, I have measurements in these fields and these should not be bigger than 320 (for example).
With Calc Builder I can make validations, but I do not know how to show a message to the user (front end).
I have seen in the field table that you have 'errormessage' but how do I trigger this, if at all possible from my validation in calc builder, or how do I validate a field directly in Hikashop custom Fields such that a value entered there is lower than a certain figure?
Hope you can help!
Thanks
-- Joomla version -- : 3.7
-- PHP version -- : 7
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : none
Hi,
have made several custom fields and have seen it is possible to validate with for example [0-9] and this is working well. However, I have measurements in these fields and these should not be bigger than 320 (for example).
With Calc Builder I can make validations, but I do not know how to show a message to the user (front end).
I have seen in the field table that you have 'errormessage' but how do I trigger this, if at all possible from my validation in calc builder, or how do I validate a field directly in Hikashop custom Fields such that a value entered there is lower than a certain figure?
Hope you can help!
Thanks
Please Log in or Create an account to join the conversation.
9 years 2 months ago - 9 years 2 months ago #274343
by nicolas
Replied by nicolas on topic Validating custom fields and showing message to user
Hi,
You can do that with the regex check. It's just a bit more complex:
This reads as:
- 320 or
- a text with 3 followed by 0 or 1 and then another number or
- a text with 1 or 2 followed by two numbers or
- a text with two numbers or
- a text with one number
You can do that with the regex check. It's just a bit more complex:
Code:
(320|3[0-1][0-9]|[1-2][0-9][0-9]|[0-9][0-9]|[0-9])
- 320 or
- a text with 3 followed by 0 or 1 and then another number or
- a text with 1 or 2 followed by two numbers or
- a text with two numbers or
- a text with one number
Last edit: 9 years 2 months ago by nicolas.
Please Log in or Create an account to join the conversation.
9 years 2 months ago #274391
by Veli
Replied by Veli on topic Validating custom fields and showing message to user
Thanks!
Your expression does not seem to work, but have found a way looking at these examples:
www.regular-expressions.info/numericranges.html
That is working very well!
Thanks again.
Your expression does not seem to work, but have found a way looking at these examples:
www.regular-expressions.info/numericranges.html
That is working very well!
Thanks again.
Please Log in or Create an account to join the conversation.
Time to create page: 0.202 seconds