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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

validate a text when we enter in TextField in mashup

Pratik_Aswale
13-Aquamarine

validate a text when we enter in TextField in mashup

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.

ACCEPTED SOLUTION

Accepted Solutions

Hi @Pratik_Aswale 

 

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

 

/VR

View solution in original post

8 REPLIES 8

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

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

Hi @Velkumar @Rocko 

Thanks for the input.

 

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

Hi @Pratik_Aswale  

 

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

 

/VR

Hi @Velkumar 

 

I used below createThing code:-

 

let thingName; 

let result = "Thing already exists";

if (!Things[thingName])

{
let params = {
name: thingName,
description: 'devil',
thingTemplateName: 'ttTT',
projectName: 'input',
tags: undefined
};

Resources["EntityServices"].CreateThing(params);

result = "Thing created successfully";
}

 

 

output:-

Pratik_A_0-1711608219836.png

After entering thingName and click button It will showing message successfully.

I use Label widget to show message.

Can we show this message in another way like notification popup?

 

 

Thanks.

Hi @Pratik_Aswale 

 

You can use Status Message to show results from service as a Popup 

 

Velkumar_0-1711609060532.png

 

/VR

 

Hi @Velkumar 

 

Here is a screenshot that what I do:-

1]                                                                                                                                                                                     2]

Pratik_A_0-1711610323991.pngPratik_A_1-1711610365750.png

 

 

 

output:-

Pratik_A_2-1711610488617.png

In above 3 screenshot-

1st one have a binding.

2nd one have a function -In this when we don't write anything on message box and click done .Then after viewing and clicking button the message shown in screenshot 3 as a blank.

Now I m just entering Dot [  .  ]in screenshot 2  on  message box and click done.

after viewing mashup, I m able to see notification message.

Pratik_A_3-1711610993117.png

How could I do  without typing anything on message box to show message?

 

 

Hi @Pratik_Aswale 

 

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

 

/VR

Announcements


Top Tags