Is it possible to access the JsonFormsAngularService outside the JsonForm standalone component? (Angular)

Hi All,

I was wondering if it was possible to access the JsonFormsAngularService from my component’s .ts file? I remember before when playing around with the library (7-8 months ago) I was able to do so. But I see that the data prop has been added, and now I am unable to access JsonFormsAngularService from the parent components .ts file.
Thanks!

Hi @Jayrack813,

we got rid off the global angular service and instead now recommend to use the jsonforms component. Any use case you had before should be covered by the jsonforms component props. Is there anything you are missing?

Internally each jsonforms component has their own JsonFormsAngularService which is still injected into each renderer, so there nothing changed.

Hi Stefan,

Yes, that’s what I thought had happened. I am trying to show validations once the submit button is clicked (Not a custom renderer). I was hoping to use the global service to switch validation modes once the button is clicked (validateAndHide to validateAndShow). I’m having a hard time wrapping my head around how to access each renderer once the submit button is clicked. Do you have any ideas?

The jsonforms component has an @Input prop named validationMode. All you need to do is to hand over "validateAndHide" initially and switch to "validateAndShow" once the user clicked on the submit button. There is no need to contact each renderer.

Thanks Stefan, I will try this!

Hi Stefan,

I was able to change the validation mode from ValidateAndHide to validateAndShow on submit, but it still does not show the validation message unless the input field is dirty. I’ve tried:
this.form.markAsDirty in the constructor, but the validation messages still are not appearing until the field is focused on. Also, I noticed when the form is rendering for the first time, the error array is empty, even though I have multiple required fields throughout the form. Again once I click on an input, the errors array is updated to show the correct errors. Can you please shed some light on this for me please? Is it possible to show validation messages immediately once validationMode is changed to validateAndShow? Is there a way to have the form be invalid once rendered and untouched? TIA