I have a simple edit functionality on the card below.
When I click edit, a textfield should appear that allows me to save it.
However, the required and defaultValue attributes are not working on my Textfield, but placeholder is (see image Textfield Issue).
Saving the edited text isn't a problem (haven't included that code here), just the aspects above.
Any help is much appreciated!!
<Card
style={{
backgroundColor: `${
task.isComplete ? "lightgreen" : task.priority ? "lightcyan" : ""
}`
}}
>
{taskEditing === task.id ? (
<CardHeader
action={
<IconButton aria-label="SaveEdits">
<SaveIcon onClick={() => editTask(task.id)} />
</IconButton>
}
title={
<TextField
style={{ width: 410 }}
required
variant="outlined"
onChange={(e) => setEditingText(e.target.value)}
defaultValue='hello'
placeholder='This is a placeholder'
value={editingText}
/>
}
/>
) : (
<CardHeader
action={
<IconButton aria-label="Edit">
<EditIcon onClick={() => setTaskEditing(task.id)} />
</IconButton>
}
title={task.text}
/>
)}