53
Views
4
Comments
Solved
Reactive Form - Reset input validation after change
Question

Hi,

Sorry if this has been responded already, I did find some posts on the topic, but not explicit.


I'm not sure if I have this right - on a react app, I have this very simply scenario (see .oml) with a list and a detail form.

When saving a new item that has validation errors (a mandatory field in this case):


And then clicking on a previous inserted list item (or inserting a new text), is it standard that the form input validation doesn't refresh automatically? 


I know I can set each of the form's input value for .valid and .message to clear these warnings - say - on the item change action. I'm just wondering if I'm missing some automation here.


Thanks!

Nuno


TestsND2020.oml

Rank: #499
Solution

Hi Nuno,

The only thing your action is doing, when you press the name of the record, is set the local variable and refresh the data.

The error message will only disappear if you make that logic on your action (set the valid property to true and set the error message as ""), or if you reload the screen using a destination in your link (see this oml if you have doubts).

Let me know if this helps,

Pedro

TestsND2020.oml

Champion
Rank: #132

Nuno Damaso wrote:

Hi,

Sorry if this has been responded already, I did find some posts on the topic, but not explicit.


I'm not sure if I have this right - on a react app, I have this very simply scenario (see .oml) with a list and a detail form.

When saving a new item that has validation errors (a mandatory field in this case):


And then clicking on a previous inserted list item (or inserting a new text), is it standard that the form input validation doesn't refresh automatically? 


I know I can set each of the form's input value for .valid and .message to clear these warnings - say - on the item change action. I'm just wondering if I'm missing some automation here.


Thanks!

Nuno


 Hi Nuno,

Please check below link

https://amit-verma331.outsystemscloud.com/Tests_ND2020/

Hope this will help you :)

- AV

Thanks

 

TestsND2020.oml

Rank: #7147

The approach you suggested works best with less number of input fields.
Could you suggest a solution where there are 50+ input fields in a module?

Thanks,

Ojaswi 

Rank: #797

@Pedro, thanks I see. Hadn't thought of the reload option - definitely an option. The scenario is kind of weird since "Click&Navigate" screens are probably a better design (maybe not for a side panel, idk).


@Amit, thanks! It seems that changing the entity on the left still leaves the validation error in place - but quickly fixed by adding your validation method to the list action link. This works for this case, but I don't know if I would implement this for a large (60+ fields) form with different rules (not only mandatory/input type).