# Enum value not getting

**URL:** <https://jsonforms.discourse.group/t/enum-value-not-getting/1899>\
**Category:** General\
**Created:** [January 6, 2024, 10:13am UTC](https://jsonforms.discourse.group/t/enum-value-not-getting/1899 "2024-01-06T10:13:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnthonyAkash](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/anthonyakash/32/872_2.png) [@AnthonyAkash](https://jsonforms.discourse.group/u/AnthonyAkash)\
**Post date:** [January 6, 2024, 10:13am UTC](https://jsonforms.discourse.group/t/enum-value-not-getting/1899/1 "2024-01-06T10:13:02Z")

</div>

import { ControlProps, isStringControl, RankedTester, rankWith } from ‘@jsonforms/core’;  
import { withJsonFormsControlProps } from ‘@jsonforms/react’;  
import { FormControl, Grid, InputLabel, TextField, Select, MenuItem } from ‘@mui/material’;

const MuiSelectControl = (props: ControlProps) =\> (  
\<Grid sx={{ mb: 2 }}\>  
\<InputLabel htmlFor={props.label} required sx={{ fontWeight: 500, color: ‘#082253’ }}\>  
{props.label}  
  
\<FormControl fullWidth sx={{ m: 0 }}\>  
\<Select  
value={props.data}  
onChange={(event) =\> props.handleChange(props.path, event.target.value)}  
error={!!props.errors}  
disabled={!props.enabled}  
displayEmpty  
\>  
  
Storage Type  
  
{props?.schema?.enum?.map((option: string, index: number) =\> (  
  
{option}  
  
))}  
  
  
  
);

const MuiTextFieldControl = (props: ControlProps) =\> (  
\<Grid sx={{ mb: 2 }}\>  
{props.label}  
\<FormControl fullWidth sx={{ m: 0 }}\>  
\<TextField  
value={props.data}  
onChange={(event) =\> props.handleChange(props.path, event.target.value)}  
error={!!props.errors}  
helperText={props.errors || props.description}  
disabled={!props.enabled}  
/\>  
  
  
);

const MuiSelectControlTester: RankedTester = rankWith(2, (schema) =\> schema.type === ‘string’ && schema.enum);  
const MuiTextFieldControlTester: RankedTester = rankWith(2, isStringControl);

export const rendererEntries = [  
{  
renderer: withJsonFormsControlProps(MuiSelectControl),  
tester: MuiSelectControlTester,  
},  
{  
renderer: withJsonFormsControlProps(MuiTextFieldControl),  
tester: MuiTextFieldControlTester,  
},  
];

I created a renderer for select and textfield but i am not able to render the fields i am checking the select field with the tester but i am not getting the enum value in this place

const MuiSelectControlTester: RankedTester = rankWith(2, (schema) =\> schema.type === ‘string’ &&

> schema.enum

);

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [January 8, 2024, 3:12pm UTC](https://jsonforms.discourse.group/t/enum-value-not-getting/1899/2 "2024-01-08T15:12:58Z")

</div>

This question is related to [this one](https://jsonforms.discourse.group/t/multiple-custom-renderer-not-rendering/1897).

By using the tester `isStringControl` your renderer will be used for all controls which refer to a type `string`. So if you have some `type: 'string'` properties in your JSON Schema which are not enums, then their associated `schema.enum` will be empty.

You need to make sure to use a tester which actually checks that your renderer is only called for enum properties. See [here](https://github.com/eclipsesource/jsonforms/blob/b00754cf4c186963ba141c11367f528c9bd5c7e4/packages/material-renderers/src/controls/MaterialEnumControl.tsx#L59-L62) for an example in JSON Forms.
