947
Views
5
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
2024-11-20 08-28-20
Pedro Marques
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
2024-02-16 07-43-18
Amit Verma

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
2022-08-24 11-43-47
Ojaswi Borade

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 

2024-09-08 11-13-40
Nuno Damaso
 
MVP

@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).


2021-07-22 23-43-44
Paul Hearmon
Staff

I believe the reason your Form wasn't resetting was because of the 'Built-In Validations' Property of your Delete button.  When set to 'Built-In Validations=No' then you've effectively disabled all checking (and resetting) of the form's fields.  In this case you are totally responsible for explicitly setting the field to False or True.

When 'Built-In Validations=Yes' then OutSystems will automatically check and *reset* each field's .Valid field according to the Mandatory fields and correct Type rules. The Form's .Valid field will also get reset too.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.