I am using the DynamicForm control in my SpFX webpart from @pnp/spfx-controls-react. I want to clear the current values in the form when the user either a) adds a new item to the list, or b) clicks the cancel button.

Is there a good way to do this?

Here is the definition of my Dynamic Form:

    onSubmitted={async () => { this.getItems(5); this.setState({formIsOpened: false}); }}
    onCancelled={() => { this.setState({formIsOpened: false}); }} 

There are only 2 fields, Title and Description. My form only allows users to add new Items, not to edit existing items. So once the form is submitted or cancelled, I just want to clear the text boxes.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.