Open Closed

[SUITE] Incorrect parameters in generated add/edit dialog for checkboxes. #6066


User avatar
0
ash.jackson created
  • ABP Framework version: v7.3.3
  • UI Type: Angular
  • Database System: EF Core (Postgres)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Steps to reproduce the issue: Generate any CRUD page/entity with suite.

Hi,

When suite is generating the angular UI, the parameter passed into the form in the case of creating a new entity is a string 'false' when it should be a boolean:

    this.form = this.fb.group({
      alwaysSplitPacks: [alwaysSplitPacks ?? 'true', []],
      serialNumbersAtGoodsIn: [serialNumbersAtGoodsIn ?? 'false', []],
      serialNumbersInStock: [serialNumbersInStock ?? 'false', []],
      scanSerialsAtGoodsOut: [scanSerialsAtGoodsOut ?? 'false', []],
      allowDuplicateExternalOrderId: [allowDuplicateExternalOrderId ?? 'false', []],
      handlingSpecification: [handlingSpecification ?? '100000', []],
      autoAllocationMethod: [autoAllocationMethod ?? '100000', []],
      clientAccountId: [clientAccountId ?? null, []],
    });
  }

This causes check boxes to be ticked, even when the value submitted is false.

When this form is submitted, the values saved are false.

The values supplied in the null coalescing operator need to respect the datatype of the entity field to be correctly reflected in the UI rather than all being cast to strings:

    this.form = this.fb.group({
      alwaysSplitPacks: [alwaysSplitPacks ?? true, []],
      serialNumbersAtGoodsIn: [serialNumbersAtGoodsIn ?? false, []],
      serialNumbersInStock: [serialNumbersInStock ?? false, []],
      scanSerialsAtGoodsOut: [scanSerialsAtGoodsOut ?? false, []],
      allowDuplicateExternalOrderId: [allowDuplicateExternalOrderId ?? false, []],
      handlingSpecification: [handlingSpecification ?? 100000, []],
      autoAllocationMethod: [autoAllocationMethod ?? 100000, []],
      clientAccountId: [clientAccountId ?? null, []],
    });
  }

1 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello ash.jackson,

    Are you giving default values for Boolean properties in ABP suite as shown in screenshot

    I have tried with this at my end if I didn't assign any default value it shows like

    So you may try accordingly.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19