JSON Forms: Object data and intance methodes

Dear all,

to be honest I am feeling a little lost, working with Form Builder and even IDM 4.9 did not provide a huge step forward regarding it´s documentation.

I know, there is a general documentation available on FormIO, but at least speaking for myself it leaves quite a few questions open, if IDM Form Builder is used.

Since the beginning I am struggling to understand the data model behind the forms, and how field values are accessed corectly.

I know, any form comes along with a data object, and (any?) field value can be accessed in JS code by the properties fof data like this

data.[APIkey of the Field] or data['APIkey']

But this seems to be working only to "read" a value of a field!

To set a field valu by JS, I got used to work with the instance object like this

instance.root.getComponent('[APIkey]').setFieldValue() orinstance.root.getComponent('[APIkey]').setValue()

If the code is used on a particular component even instance.setFieldValue() is working.

I am wondering, if someone can tell me, why I cannot use the data object properties to set a value to a field?

Is there any reference which methods a certain component provides?

And one last question: Is there any documentation on the datatype or syntax is expected for a component's value?

Kind regards

Thorsten 

 

  • 0  

    Hello,

    TL;DR:  I can't answer your questions. I completely understand the frustration and I feel the same way. I just wanted to use this post to express my displeasure.


    I can understand your frustration very well, I feel the same way.
    I also have the impression that with every form builder version, you almost start from 0 again. You think you have understood the functionality and after the upgrade the functionality no longer works. Either because it was a bug before and has now been fixed, or it no longer works because it is now a bug.

    When it comes to documentation, people also like to refer to Form.IO a lot and like to use it as an excuse (personal impression) that you should look there in the documentation because it is a third-party manufacturer.

    Setting the values is not always 100% clear to me either. I also use the methods you mentioned, but it's not clear to me when it's best to use what.

    Unfortunately, I can't provide a meaningful answer to your questions, I don't know of any documentation for the last two questions and I've been looking for it again and again. In the end, I think I created a form with the required field types and a button which outputs “console.dir(data)” as a JS script. I deployed the form and filled it with values in the browser and then looked at how the values are saved in the console.


    BR

    Tobias