Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
On mashup Load:
we entry the value numeric entry box the button is not enabled
When i click outside the numeric box the button is enabled
but i want that the button should be enabled as soon as we enter the value. Not need to click outside or around them.
Solved! Go to Solution.
I did an quick and dirty approach here. There are still some cases that are not taken into account here. Just like negative decimals etc. What happens if an user enter "alphabetic" values or several "." or ","...
I think this should be enough as a starting point
if (NumericEntry == undefined || NumericEntry == null || NumericEntry == "" || NumericEntry == "NaN" || NumericEntry == "0") {
Output = "0";
} else {
NumericEntry = NumericEntry.replace(/,/g, ".");
if (!NumericEntry.includes(".")) {
Output = NumericEntry.replace(/^0+/, '');
} else {
Output = NumericEntry;
}
}
Do not use the auto-evaluate of the expression. Use the changed event instead.
The UI should look like.
Hi Hrishab,
depening on your ThingWorx version I suggest, that you use the normal TextField-Widget and apply some "9999" in the mask field (On TWX version 9.4 the mask property is not working as expected anymore). So your user just can type numerical entries in your field. It also will refresh your value on every text changed event.
The problem with that workaround is that you can have leading zeros and cant type an "," or "." for decimals.
You could also apply some expression that "cleans" the inserted value, whenever the text changes. => remove leading zeros or allow just one ","/".".
I hope I could help you out
Best regards
Markus
pls can you provide me the expression?
I did an quick and dirty approach here. There are still some cases that are not taken into account here. Just like negative decimals etc. What happens if an user enter "alphabetic" values or several "." or ","...
I think this should be enough as a starting point
if (NumericEntry == undefined || NumericEntry == null || NumericEntry == "" || NumericEntry == "NaN" || NumericEntry == "0") {
Output = "0";
} else {
NumericEntry = NumericEntry.replace(/,/g, ".");
if (!NumericEntry.includes(".")) {
Output = NumericEntry.replace(/^0+/, '');
} else {
Output = NumericEntry;
}
}
Do not use the auto-evaluate of the expression. Use the changed event instead.
The UI should look like.