Skip to main content
1-Visitor
October 5, 2021
Question

How to validate textbox, dropdown which are in the repeater widget?

  • October 5, 2021
  • 2 replies
  • 3862 views

Hi Everyone,

I have one repeater which contain textboxes(all are string base type) and dropdown but I am not able to validate those widget which are in the repeater. 

When I am using this repeater into another mashup where I want to validate all textbox and dropdown are mandatory filled.

I am using thingworx 8.1 version, Please help me if you have any solution on it.

2 replies

Support
October 6, 2021

Hi @DT_316496.

 

Is the validator set on the inner mashup?  If you run the inner mashup, does the validation work?

 

Note that you are running an extremely old version of ThingWorx that has not been supported in some time.  The repeater widget was replaced in the more recent versions of the product by the collector widget, which performs much better.

 

We recommend upgrading to one of the supported versions of the product (9.0, 9.1, and 9.2) due to the many security updates, bug fixes, and new features that are available.

 

Regards.

 

--Sharon

DT_3164961-VisitorAuthor
1-Visitor
October 7, 2021

Yes I know I am using too old version but as of now I have to manage all this requirement in this version only.

I attached image of my requirement you will get some idea.

Is the validator set on the inner mashup?  If you run the inner mashup, does the validation work?

-I have applied validator on inner mashup but it failed because outer mashup submit button click event I have to sent to inner mashup which I don't know how to do it.

Description:

  1. Inner mashup having one row which include textboxes and drop down
  2. As you can see there is add line button which will add the row in the inner mashup as I have already added two rows.
  3. So when I will click on submit button which are present in the outer mashup I want to validate all the filed in inner mashup which is filled or not.
    • If all fields all filled then submit button will click the service which add all entries in the data table
    • If all fields are not filled I want show the error symbol which are in the image as you can see.
  4. Can you please tell how to achieve this in thing Worx.

 

12-Amethyst
October 25, 2021

Hi,

 

In the repeater or the newer collection widget you will need to use a session variable to accomplish this task.  The session variable will hold the data which can be modified in each row.  This is also where you can indicate if the row is "valid" or not using the validator in the inner mashup.  Once the submit button is clicked the data in the session variable is processed checking the validation flag before calling the next service or displaying an error message.

 

Thanks,

 

Travis

DT_3164961-VisitorAuthor
1-Visitor
October 26, 2021

For one row I have done the validation part but when I add multiple row it will not working for multiple row.
For one row it is working but for more row it is not working.
steps:

  • I am passing inner mashup validator result to session and get that result in the outer mashup.
  • Taking that result to validator I am passing opposite result to same session variable.
  • Again when I click on submit I am passing that result to this session variable to trigger inner mashup validator.
  • Then finally if the all fields are filled then I am passing inner mashup result to other session variable and that result I have pass to outer mashup other validator which calculate that all fields are filled or not.

From above steps I have done validation for only one row but how I can validate for multiple row.

I am struggling to do that?

Or Please let me know if I can do this adding multiple row by using any other widgets or any other grids so it will easy to validate.

Or
Should I do it using Grid widget but in the grid widget how can i add dropdown?

Should I display a multiple row which are given in the attachment by using grid apart from repeater widget?

Please refer attachment.

12-Amethyst
October 26, 2021

Hello,

 

For the session variable you will have to use an infotable with one row per data row or you can use a JSON variable with the row identifiers as keys.  Please note there is a bug related to JSON session variables where you can not provide a default value on the thingShape.  This has been fixed in later versions I am just not sure which version it started in.

 

This will also require you to manage the session variable when you are adding a deleting rows.

 

In a recent implementation I just did we used the incoming datas row number as the unique identifier into the session variable.

 

Thanks,

 

Travis