New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(NgXform): validate all fields on submit #34
Conversation
edetec
commented
Sep 18, 2018
- Change validation message color to red
- validate all fields on submit
Pull Request Test Coverage Report for Build 350
💛 - Coveralls |
src/ng-xform/ng-xform.component.html
Outdated
<ng-xform-form-group [isHorizontal]="horizontalForm" [labelWidth]="labelWidth" [fields]='fields' [form]=form [editing]='editing'></ng-xform-form-group> | ||
<div class="row"> | ||
<div class=" col-sm-12 text-right"> | ||
<button type="submit" class="btn btn-primary" (click)="setEditing(true)" *ngIf="editing === false"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to keep the buttons bar inside <form>
tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot it, I'll change back.
@@ -80,7 +80,19 @@ export class NgXformComponent implements OnInit, OnChanges { | |||
return modelToSend; | |||
} | |||
|
|||
validateAllFormFields(formGroup: FormGroup) { | |||
Object.keys(formGroup.controls).forEach(field => { | |||
const control = formGroup.get(field); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just being picky, but wouldn't be more correct to define const control
outside the loop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, because const receives control of the iteration field and is valid only for the scope of the arrow function.
feat(DateRangeField): add Date range field support
feat(DateRangeField): add Date range field support feat(SelectField): add flag to force search on first focus