-1 shows up on a numeric text field bound to PLC/OPC tag

I have a numeric text field which has its integer value bound to the PLC tag, but also I scripted it to write to the tag as well. User can type in a number - press Enter - value writes to the tag. The problem is that every once in a while - 1 shows up in the field and messes up the tag. I have the tag set up to accept only the range of 0 to 200 and nothing else. What causes -1 to show up in the field? —Is it the OPC problem? How to prevent it from showing and writing to the PLC tag? So, I want the number that is entered to stay in the text field unless someone changes it.

Thanks.

[quote=“pstojakovic”]I have a numeric text field which has its integer value bound to the PLC tag, but also I scripted it to write to the tag as well. User can type in a number - press Enter - value writes to the tag. The problem is that every once in a while - 1 shows up in the field and messes up the tag. I have the tag set up to accept only the range of 0 to 200 and nothing else. What causes -1 to show up in the field? —Is it the OPC problem? How to prevent it from showing and writing to the PLC tag? So, I want the number that is entered to stay in the text field unless someone changes it.

Thanks.[/quote]
Same is happening by me also… Nobody?

What kind of script are you using to write the value to the tag? Is it a propertyChange script?

Why are you writing the value to the tag with a script? A bidirectional binding on the component would allow you to write a value back to the tag and you would not need to script the write.

[quote=“Greg.Simpson”]What kind of script are you using to write the value to the tag? Is it a propertyChange script?

Why are you writing the value to the tag with a script? A bidirectional binding on the component would allow you to write a value back to the tag and you would not need to script the write.[/quote]
If it would be that simple… :slight_smile:
I’m using numeric text field in the template for converting the integer (milliseconds) to Siemens Simatic PLC timer format (S5Time). And that requires some custom tag types and ‘some’ scripting…