972
Views
6
Comments
Validation inputs inside table records
Question

I can valid an input outside a table record, but when i got input inside table record and if i send valid 'false' its not red and the validation messages is not show. Is there any way i can you validation inside table record?

2019-10-09 06-46-56
Daniel Lourenço
Staff
Hi Hugo,

I was investigating and in fact it seems that it is not possible to manipulate validation messages in widgets inside Table Records.

The solution then is to do this manually - in the List that populates the TableRecords list add a structure that is the Validation structure (with a ValidationMessage and an IsValid fields). When you submit the TableRecords, iterate through it in the screen action and fill in the validation variables for each of the items. In case there are errors, you can post-back to the screen where you then have to render the validation information (depending on the validation information, set the style and the message on each input in the list).

There is something missing in my explanation - how do you maintain the TableRecords information from the a screen action to the next screen load? The answer is that in the preparation of the screen, in case you are in a Post Back, you have to put an assign node that sets the List that is populating the TableRecords to the TableRecords.List value (List = TableRecords.List). It seems awkward, but that is the solution - if you do not do this, the TableRecords.List is replaced with the previous List value again.

I hope this helps.

Best Regards,
Daniel Lourenço
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Hereby confirmation this still doesn't work on platform 9.0.1. It makes sense, since Valid is a property of the input widget, and the input widget has no .Current or the like to indicate which row's widget you want to set invalid. So now I'm stuck having a Valid property for each field I want to be able to invalidate, and applying the Not_Valid style conditionally. Not nice!
2024-09-14 05-42-00
Ozan Can Çalı
Champion

This topic is indeed old, but now we have the possibility to do this sort of validation by the Event System Forge component: https://leonardofernandes.outsystemscloud.com/oldeventshelp/Lesson02.aspx?(Not.Licensed.For.Production)=

UserImage.jpg
Vitor Shimada

As a work around, I created a boolean local variable named "Valid"

Then in the style in-line, made a IF condition containing the "Valid" and also an IF to verify if the input is empty :


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Vitor,

I think it's better to define the CSS as a class, then apply that class conditionally in the Style Classes property, rather than use in-line CSS, which is badly maintainable. The advantage is also that you can reuse it more easily, and change it for all instances in case you'd want a different styling.

2023-03-09 17-04-45
Nivaldo Pereira
Champion
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.