tomastrajan / angular-ngrx-material-starter

Angular, NgRx, Angular CLI & Angular Material Starter Project
https://tomastrajan.github.io/angular-ngrx-material-starter
MIT License
2.82k stars 919 forks source link

Form inputs #514

Closed KadarH closed 1 year ago

KadarH commented 4 years ago

I think that the button save in the examples module ( form ) has to be disabled if the auto save is disabled or while the form is not valid .

if( autosave ) => disabled
else while( form not valid ) => disabled
=> enabled

The actual use :

[disabled]="form.get('autosave').value

My proposition :

[disabled]="form.get('autosave').value || !form.valid"

codecov-io commented 4 years ago

Codecov Report

Merging #514 into master will increase coverage by 0.36%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #514      +/-   ##
==========================================
+ Coverage    70.1%   70.47%   +0.36%     
==========================================
  Files          65       65              
  Lines         552      552              
  Branches       34       34              
==========================================
+ Hits          387      389       +2     
+ Misses        157      155       -2     
  Partials        8        8
Impacted Files Coverage Δ
...tarter/src/app/core/animations/route.animations.ts 100% <0%> (+20%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8de0587...60d59a3. Read the comment docs.

tomastrajan commented 4 years ago

Hi @KadarH !

We want to be able to also safe invalid form, it's like work in progress. Maybe not ready yet but we dont want to lose it and be able to continue when we come back.

We only want to prevent SUBMIT of the form if its not valid.

Hope that makes sense!

KadarH commented 4 years ago

Hi @tomastrajan

So if we want to be able to also save invalid form, it is more logical that the inputs are not required. In my opinion, required restrictions is used to tell the user that he can't save the form until the input is not empty.

Proposition :

Or

What do you think ? Regards

KadarH commented 4 years ago

Hi @tomastrajan

So if we want to be able to also save invalid form, it is more logical that the inputs are not required. In my opinion, required restrictions is used to tell the user that he can't save the form until the input is not empty.

Proposition :

  • No restrictions ( all input become not required ) => save form

Or

  • The form cannot be saved until the inputs are filled ( unless the autoSave is activated )

What do you think ? Regards

tomastrajan commented 4 years ago

@KadarH maybe we should just rename Save button to Save draft because i think its a valid use case... I work on something big, it's not yet all valid, I need more data to finish the filling of the form, but I want to continue tomorrow, so I save the draft and continue tomorrow. Once I filled everything and form is valid I can finally submit it for real ?