How to custom onSubmit in tinacms

Viewed 52

I have problem from my tina project. My problem is I want to create my own submit button in tinacms project. Not from sidebar or top bar that has been provided by tinacms.

I want to create custom button onSubmit.

is there a way to do this ?

Tinacms docs : https://tina.io/docs/reference/toolkit/forms

1 Answers

about my question I has been solved by creating a function and call .submit() from tinacms.

like this :

const cms = useCMS()
function(){
   cms.forms.all()[0].submit()
}

and this function I triggered through global state.

And another way you can loop through the forms to replace writing index 0.

I hope this answer helps others readers.

Related