cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

In Mashup Text field should allow only integer value

SV_14424458
2-Explorer

In Mashup Text field should allow only integer value

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. 

1 REPLY 1
Rocko
19-Tanzanite
(To:SV_14424458)

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. 

Announcements


Top Tags