Adding a button to JsonForms

Hello all,

I’ve created a custom renderer, that contains a button that I hope will “submit” the form. By submit, I mean I’d like to get the data from the controls and then based off that data produce a new form. I am able to do all this using JsonFormsAngularService. My question is: how do register the button in my schema.json? What is the type one would use for a button? I’ve searched in the docs and didn’t see any info. I assume I am missing or overlooking some aspect here. I’ve successfully added a button outside the form, but with this approach I am not able to use the JsonFormsAngularService to create/modify a new form. Thanks for your help.

Hi @Jayrack813, as you noticed the concept of a submit button doesn’t really fit to the JSON Schema, however you could add it to the UI Schema. I would either add it as a separate element or as an option to the root layout. Then you can add a custom renderer for it.

However I don’t think you really need it. As you outlined, submit buttons are usually rendered outside of JSON Forms. Here you can then just add a new additional jsonforms component or replace the existing one.

Are you on the latest version of JSON Forms? We refactored the Angular bindings a while ago to allow for multiple forms via multiple jsonforms components instead of tunneling everything through the service. See here for the migration guide.

Thanks for the reply Stefan,

I am using version 3.0, I actually didn’t see the migration guide on my initial studying. Thanks for pointing that out. I think I will go with the second approach adding new JSonforms depending on the output of the initial form. Thanks alot for the prompt response and keep up the good work!