Starts in:
1 DAY
23 HRS
19 MIN
31 SEC
Starts in:
1 D
23 H
19 M
31 S
Open Closed

FormProp change dynamically based on value of other prop #6820


User avatar
0
devpayoff created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info:

  • ABP Framework version: v7.4.5
  • UI Type: Angular
  • Database System: EF Core
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

{ type: ePropType.Enum, name: 'type', id: 'type', displayName: 'Blox::Entity:ModelDetail.Type', options: data => { return data.getInjected(ContentModelDetailService).getTypeSelectOptions$(); }, validators: () => [Validators.required] }, { type: ePropType.Enum, name: 'encryption', id: 'encryption', displayName: 'Blox::Entity:ModelDetail.EncryptionKeys', options: data => { return data.getInjected(ContentModelDetailService).getTypeEncryption$() ?? null; }, defaultValue: null as unknown as string, visible: data => { debugger; return true; } },

I have these 2 props, both select, i don't know how to get the value selected in my "type" prop, in debug i have record that is undefined (it's filled only in editForm and not dynamic) so how i get the value of my "type" prop dynamically so every time i change it i can hide or not my "encryption" select?


1 Answer(s)
  • User Avatar
    0
    sinan created
    Support Team Angular Developer

    I understand your case. in visible property you can't get the value of selection.

    If you want to change the visibility of prop you can do something like this.

    visible: data => {
        const formValue = data.getInjected(YourComponent).getFormValue();
        return formValue.team === "GS";
    }, 
    
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06