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

expressionProperties is not working in formlyPrimeng #3889

Open
Priyadarsini-techriff opened this issue Mar 29, 2024 · 1 comment
Open

expressionProperties is not working in formlyPrimeng #3889

Priyadarsini-techriff opened this issue Mar 29, 2024 · 1 comment
Labels

Comments

@Priyadarsini-techriff
Copy link

{
fieldGroupClassName: 'formgrid grid mt-2',
fieldGroup: [
{
className: 'field col',
key: 'gender',
type: 'radio',
defaultValue: 'Female',
templateOptions: {
label: 'Gender :',
required: true,
options: [
{ value: 'Male', label: 'Male' },
{ value: 'Female', label: 'Female' },
],
},
},
{
className: 'field col',
key: 'interest',
templateOptions: { label: 'Interest :' },

      wrappers: ['form-field'],
      fieldGroup: [
        {
          type: 'checkbox',
          key: 'Movies',
          className: 'ui-g-12',
          templateOptions: { label: 'Movies' },
        },
        {
          type: 'checkbox',
          key: 'Cricket',
          className: 'ui-g-12',
          templateOptions: { label: 'Cricket' },
        },
        {
          type: 'checkbox',
          key: 'Music',
          className: 'ui-g-12',
          templateOptions: { label: 'Music' },
        },
        {
          type: 'checkbox',
          key: 'Book',
          className: 'ui-g-12',
          templateOptions: { label: 'Books' },
        },
      ],
      // Custom expression function
      expressionProperties: {
        'templateOptions.required': (
          model: any,
          field: FormlyFieldConfig
        ) => {
          return field.model?.gender === 'Male'; // Set required to true if gender is Male
        },
      },
    },
  ],
},

whenever i select male the interest field should be required field.but its not working in my case

@Sankey1506
Copy link

Facing similar issue in Kendo as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants