guys I am trying to implement RxWebValidators.... Following is my model class I'm using:
import { propObject, required } from '@rxweb/reactive-form-validators';
import { DocumentSubmission } from './document-submission.model';
import { TenantContractDetails } from './tenant-contract-details.model';
import { TenantContractGeneralInformation } from './tenant-contract-general-information.model';
export class TenantContract {
@propObject(TenantContractGeneralInformation)
BasicInformation: TenantContractGeneralInformation = new TenantContractGeneralInformation();
@propObject(TenantContractDetails)
TenantContractDetails: TenantContractDetails = new TenantContractDetails();
@propObject(DocumentSubmission)
TenantContractDocuments: DocumentSubmission = new DocumentSubmission();
}
FormGroups are created in the following way:
createFormGroup(): void {
this.contractForm = this.formBuilder.group(
// {
// BasicInformation: this.formBuilder.formGroup(new TenantContractGeneralInformation()),
// TenantContractDetails: this.formBuilder.formGroup(new TenantContractDetails()),
// TenantContractDocuments: this.formBuilder.formGroup(new DocumentSubmission())
// }
new TenantContract()
);
console.log(this.contractForm);
}
VALID
Status. Do not understand as to why this is happening.
@model
decorator but it doesn't work.
@ajayojha This do not work:
export class TenantContractGeneralInformation {
@disable({conditionalExpression:function(control:AbstractControl){return true; }})
@prop()
ContractNumber: string = '';
@disable({conditionalExpression:function(control:AbstractControl){return true; }})
@prop()
ExternalContractNumber: string = '';
AccountGUID: string = '';
@required({ message: "FIELD_REQUIRED" })
WorkerCity: string = '';
Any intended reason behind this? How do we mark fields as disabled if we want to without a second property.
Guys this is my model
@required({ message: "FIELD_REQUIRED" })
@date({ message: "INVALID_DATE", allowISODate: true })
@minDate({ value: new Date().toDateString(), message: "INVALID_DATE", allowISODate: true, fieldName:'ContractStartDate', operator: ">" })
ContractExpiryDate: Date;
and template:
<div class="col-4">
<div class="form-group">
<label for="ContractStartDate"
class="control-label">{{ "TENANT_CONTRACT.GENERAL_INFORMATION.CONTRACT_START_DATE" | translate }}</label>
<div class="form-group mycustom">
<input type="text" autocomplete="none" class="form-control" placeholder='{{"SELECT_DATE" | translate}}'
name="ContractStartDate" ngbDatepicker #dpContractStartDate="ngbDatepicker"
formControlName="ContractStartDate"
/>
<div class="input-group-prepend">
<button class="btn" (click)="dpContractStartDate.toggle()" type="button">
<i class="far fa-calendar-alt"></i>
</button>
</div>
</div>
<small class="text-danger" *ngIf="generalInformationGroup.controls.ContractStartDate.errors">
{{ generalInformationGroup.controls.ContractStartDate.errorMessage ||
generalInformationGroup.controls.ContractStartDate.errors.date.message ||
generalInformationGroup.controls.ContractStartDate.errors.mindate.message | translate }}</small>
</div>
</div>
I keep getting the invalid date error. can't apply min date validation
Can't bind to 'rxwebform' since it isn't a known property of 'form'
Guys its not working here also.