mobx-react-form
mobx-react-form copied to clipboard
How to set form submit disabled while I fetching async data for select fields?
I'd either use a separate mobx store, or use the extra
state property added in #220. In your onSubmit
handler, you can check form.state.extra.isLoading
and abort if necessary. In addition, you can set your Submit button to a disabled state if that prop is true
Thanks. How to abort the form submit on onSubmit handler?
I set submit button to be disabled when form.state.extra.isLoading
is true.
but, If i set form.state.extra.isLoading
to true in some function start and false at the end of the same function, the submit button is not re-rendering its state.
I’d confirm that extras.isLoading
is observable and that your component can respond to it. As for stopping onSubmit, typically I’d set valid = false, but there may be a cleaner way (on mobile atm so I can’t dig thru the docs)