Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 07:35
    Andrei-Bahushevich edited #476
  • 00:09
    Andrei-Bahushevich opened #476
  • Mar 01 16:14
    lkachun9129 commented #460
  • Feb 25 08:30
    Kiran-Pawar edited #475
  • Feb 25 08:29
    Kiran-Pawar edited #475
  • Feb 25 08:29
    Kiran-Pawar opened #475
  • Feb 24 17:36
    kelvinsleonardo edited #474
  • Feb 24 16:20
    kelvinsleonardo opened #474
  • Feb 19 06:43
    lkachun9129 opened #473
  • Feb 17 17:15
    ajayojha commented #471
  • Feb 17 17:13
    kelvinsleonardo commented #471
  • Feb 12 11:01
    DuncanFaulkner opened #472
  • Feb 10 22:23
    kelvinsleonardo edited #471
  • Feb 10 22:21
    kelvinsleonardo opened #471
  • Feb 08 19:41
    zavadmar commented #460
  • Feb 08 10:22
    DuncanFaulkner commented #465
  • Feb 07 16:28
    mligtenberg commented #470
  • Feb 07 16:27
    mligtenberg opened #470
  • Feb 05 09:24
    afzalmansuri opened #469
  • Feb 04 09:44
    Ushmidave opened #468
freshdev1
@freshdev1
@tutods_twitter I think last supported version is Angular 10 for RxWebValidators. Ajay will confirm.
freshdev1
@freshdev1

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);
  }
If I create formgroups this way none of the required or other errors are fired. If I create it the way which is commented out, all errors works as expected
Any ideas as to why this is happening.
In the above case all the formgroups have VALID Status. Do not understand as to why this is happening.
Ajay Ojha
@ajayojha
@freshdev1 As I can see that you are creating a FormGroup through model then it's preferable to use 'formGroup' method instead of 'group' method.
@tutods_twitter there is one alternative to make this work as I provided a solution in the past to someone, but I forgot what was that, will update soon.
@kalathiyan will update you soon.
Ushmidave
@Ushmidave
@kalathiyan passing or string value is not possible using startsWith validator you can create a feature request for the same
@radixdt2020 any update on your issue ?
freshdev1
@freshdev1
@ajayojha thanks for the response, it worked. I did remember I used formGroup first but it was not working. But this works now. Thanks a lot sir.
radixdt2020
@radixdt2020
@Ushmidave Still not face any issue in rxwebcore version 1.1.6.
Ushmidave
@Ushmidave
@radixdt2020 What issue are you facing now ?
freshdev1
@freshdev1
Hello everyone. Any idea if I can disable the whole formGroup based on a condition through model decorator?
I tried to apply disable using the @model decorator but it doesn't work.
disable is not a supported I believe.
freshdev1
@freshdev1

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

freshdev1
@freshdev1

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

freshdev1
@freshdev1
@ajayojha dude can you tell me what mistake I am doing above.
MINDATE error is not removing
Nikunj V Kalathiya
@kalathiyan
image.png
HI RxTeam,
in above image SelectedJournal is object, is there any any way to bind that object instead of journalId in rx-select ?
freshdev1
@freshdev1
Group anybody who has faced the min error I mentioned above.
Any help would be appreciated. I don't understand where I am wrong.
freshdev1
@freshdev1
Anybody happen to use it with Template driven form?
I am finding it extremely hard to get it to work
it gives the following error:
Can't bind to 'rxwebform' since it isn't a known property of 'form'
Can anyone suggest what error I am making.
freshdev1
@freshdev1
fixed it. F has to be capital...
freshdev1
@freshdev1
now added a numeric validation. but it is not working
:(
freshdev1
@freshdev1
I think I will have to dump this product..... There is no support from the community around it.
I have been struggling so much but haven't got any response on anything to this date
Ushmidave
@Ushmidave
@freshdev1 template driven validation is applied along with the prefix rx, incase of numeric validation using [rxnumeric], Please refer to this example
freshdev1
@freshdev1
@Ushmidave thank you sir. But I do not see this in the documentation. I tried everything to get it to work.
but it works now in your example thank you. I will incorporate and comeback in case still it is not working.
Ushmidave
@Ushmidave
@freshdev1 the documentation of template driven numeric validation is present here
freshdev1
@freshdev1
Thank you for the guidance.
elharmouchi
@elharmouchi
2021-01-20_20-25-16.png
hello , please how to validate that user must check at less one checkbox using decorator based validation approach with rxweb
thank you
2021-01-20_20-38-20.png
Ushmidave
@Ushmidave
@elharmouchi i suggest you to use oneOf validation decorator for the described case : https://docs.rxweb.io/form-validations/oneOf/decorators
elharmouchi
@elharmouchi
@Ushmidave thank you pro
Nikunj V Kalathiya
@kalathiyan
Hi RxTeam
in rx-select do we have any provision to disable option from dropdown ?
image.png
like this ?
New York is disabled
freshdev1
@freshdev1
var docsControls = this.contractForm.controls["TenantContractDocuments"] as FormArray;
    docsControls.clear();
    docsControls = new FormArray([]);

    this.contractForm.controls["TenantContractDocuments"] = <RxFormArray> docsControls;

    documentsArray.forEach((element: DocumentModel) => {
      let docGroup = this.formBuilder.formGroup(DocumentSubmission);

      let document = element as DocumentSubmission;

      docGroup.patchValue(document);
      docsControls.push(docGroup);
    });
I don't know why when I try to get the this.contractForm.modelInstance under TenantContractDocuments I find there is an array but without any values