Skip to main content
1-Visitor
December 19, 2025
Solved

In Mashup Text field should allow only integer value

  • December 19, 2025
  • 3 replies
  • 480 views

Hi, I have a scenario where in Thingworx mashup there is a text field it should allow only integer. Other than that any text entered it should show "Please enter integer value". How to achieve this?
Thningworx version 9.6

Can anyone help on this. 

Best answer by Rocko

Any chance you can use the Numeric Entry widget instead? Because it was made for that. It comes with a title and a tooltip.

Otherwise you can use a TextField with attribute HintText to indicate the user needs to enter a number, plus validation as explained here: https://support.ptc.com/help/thingworx/platform/r9.6/en/#page/ThingWorx/Help/Mashup_Builder/Widgets/ApplyingValidationRulesToWidgets.html

You would bind the Validate event to an expression of type "Validator", add a text parameter and this code:

if (text.match(/[^\d]+/g))
output="invalid";
else
output="valid";

Probably add a plus/minus to the regex if negative ints are acceptable. 

3 replies

Rocko
Rocko19-TanzaniteAnswer
19-Tanzanite
December 19, 2025

Any chance you can use the Numeric Entry widget instead? Because it was made for that. It comes with a title and a tooltip.

Otherwise you can use a TextField with attribute HintText to indicate the user needs to enter a number, plus validation as explained here: https://support.ptc.com/help/thingworx/platform/r9.6/en/#page/ThingWorx/Help/Mashup_Builder/Widgets/ApplyingValidationRulesToWidgets.html

You would bind the Validate event to an expression of type "Validator", add a text parameter and this code:

if (text.match(/[^\d]+/g))
output="invalid";
else
output="valid";

Probably add a plus/minus to the regex if negative ints are acceptable. 

Rocko
19-Tanzanite
January 5, 2026

For the record, TWX 10.1 doubles down on using TextField, by providing better options and making Numeric Entry legacy.

See "enabling numeric input mode" here: https://support.ptc.com/help/thingworx/platform/r10.1/en/#page/ThingWorx/Help/Mashup_Builder/Widgets/TextFieldWidgetThemable.html

 

 

12-Amethyst
December 26, 2025

Hi @SV_14424458 

It appears that this post may answers your question.  For the benefit of other Community Members who may have the same question, it would be great if you could designate it as the Accepted Solution.

In the event that this response did not answer your question, please post your current status so that we can continue to support.

Thanks for using the PTC Community!

Regards,
Abhi

13-Aquamarine
January 5, 2026

To let you know, in Thingworx 10.1 the Text Field Widget (Themable) got improvement by a property called NumericInputMode. 

With this you can set only numeric entries, decimals or integers. (the Numeric Entry widget has become a Legacy Widget)

Rocko
19-Tanzanite
January 5, 2026

Beat me by 3 minutes!