Skip to main content
13-Aquamarine
March 27, 2024
Solved

validate a text when we enter in TextField in mashup

  • March 27, 2024
  • 2 replies
  • 2286 views

Hello,

I want to validate a ThingName in thingworx. Like In Mashup, when I type a thing name in textbox field and enter on click button, the validator function should be check the thing which we have enter in textbox field is already available or not, if  yes the message should be Thing Created Successfully and if not then should be Thing Already Exist.

So how can we do that?

Pratik_A_0-1711522972375.png

 

 

Thanks.

Best answer by Velkumar

Hi @Pratik_Aswale 

 

Instead of Clicked Event to show a status message. Use ServiceInvokeCompleted Event from the service to trigger/show popup message.

 

/VR

2 replies

Rocko
19-Tanzanite
March 27, 2024

Instead of using validators, you could have the service where you create the thing return a status message with either success or failure message.

19-Tanzanite
March 27, 2024

Hi @Pratik_Aswale 

 

You cannot use the validator function to check whether Thing exists.

 

As @Rocko said you can use the service to validate it. Something like this

let result = "Thing already exist";
if(!Things[thingName])
{
 //Put your Script to create Thing
 
 result = "Thing created successfully";
}

 

/VR

13-Aquamarine
March 28, 2024

Hi @Velkumar @Rocko 

Thanks for the input.

 

After this  I m not able to see notification like Thing already exist or not in mashup.

19-Tanzanite
March 28, 2024

Hi @Pratik_Aswale  

 

Could you please post your implementation here. It will help us to understand issue better.

 

/VR