How can I make the Attribute Value field clear automatically when the user changes the Attribute Name selection in a React-Admin form? The images I have attached show that when I changed the Attribute Name selection the Attribute Value field still retains that same previous input but I actually want to clear it. Attribute Name is a and Attribute Value is a
enter image description here
enter image description here
Not sure what else to do
2
Answers
if i understand your question, you want to clear the Attribute value when you change attribute name.
first you need to make state to your attribute value
exemple:
const [attributeName, setAttributeName] = useState(”);
Second you need to add onChange event to your dropdown menu (attribute name) then you handle this event and update the state with setAttributeName(”)
let me know if you need more help 🙂
Try something like this: