Skip to content
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

Merged
merged 4 commits into from Sep 20, 2018

Conversation

edetec
Copy link
Contributor

@edetec edetec commented Sep 18, 2018

  • Change validation message color to red
  • validate all fields on submit

@coveralls
Copy link

coveralls commented Sep 18, 2018

Pull Request Test Coverage Report for Build 350

  • 50 of 59 (84.75%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.8%) to 80.93%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/ng-xform/select-field/select-field.component.ts 1 3 33.33%
src/ng-xform/date-range-field/date-range-field.component.ts 30 37 81.08%
Totals Coverage Status
Change from base Build 333: -0.8%
Covered Lines: 549
Relevant Lines: 634

💛 - Coveralls

<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">
Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

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?

Copy link
Contributor Author

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
@edetec edetec merged commit 4067c28 into master Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants