15
Views
4
Comments
Validation inputs inside a list record
Question
Application Type
Reactive

Hello,

And I have a list with inputs to be able to create, edit and delete a record, like an editable table.

How can I add built-in validations to inputs of the form that is inside a table?

I can't access the input.valid and validmessage to customize a message

The idea is when I click on "save" for each row and the mandatory fields are not filled, a message is supposed to appear below the "Required filed" input. is it possible in a reactive application?

Thank you

Hi! 

The form you have is in a webBlock?

If not you can try to build a webblock and put the form in that webblock and the webblock in the line. 

Stay safe

Graça

Rank: #127

Hi Rita,

I think you mean something like

Form

+-- List

     +-- Inputs for one of the items in your collection

+-- Save Button : for saving all changes at once


You are right, the inputs in your list are not available in the code as widgets, so you can't reach their valid and validationtext properties.  

You could probably imitate some of the behaviour you want with some sort of webblock wrapping your inputs, and inside the webblock you can update the .valid and the .validationmessage, but that could get real messy real quick.  So the question is do you or your users want this bad enough to invest some time into figuring it out...

Dorine



Hi Rita,

Good morning!

As mentioned by Maria and Dorine, the way with this is via a webblock.

Can you share an OML for us to have a better picture?

Thank you and kind regards,

Chris

Champion
Rank: #371

Hi, friend!

I already did some like this. What you can do is:

1) Create a simple block with the input field. The list values will be represented by the input block

2) The onchange action of input will trigger an event to fill the variable on the father element.

3) The save will iterate the list to check if all values are filled and if not, set the parameter to the block to false

I can't remeber exactly what have i done but was something like that


Kind regards