I’m using autoform, and I am trying to see if we can have fields displaying and hiding depending on the value of other fields… I know it can be done using a second schema, but I need to have it in one… can it be doen? Or am I out of luck? Is there maybe a plugin?..
Or is it possible in one schema, and am I reading the field-values example wrong?
which would give you a dynamic array, enableing you to add and delete elements on the fly. This kind of dynamic behavour would suggest that it would be possible to show/hide fields based on the value of another field. But I have not been able to find a example - except the one I linked to in the OP. I use/can use only one schema, so I am looking to a alternative…
yes, I know that example. However, my current setup uses a form where the schema is dynamically added to the form during runtime. EG: I need a schema where there is only the schema and a single form-entry in the template. I am not adding extra template-lines during runtime. So: I am trying to get to this functionallity, while having only
in the template… I’m not sure if this is possible. But for instance the array-function is working this way (adding “subforms” reactivly to user input too… so I was hoping this could be done for this function too
Thanks for your answer anyway - it is good to know people very willing to help!
How would you go about using quickform as subcategories for the dynamic field, though? This schemas have nothing that identify them to go if this field is selected auickform 1, else quickform 2.
In the end, I ditched Autoform for JSONForm in this instance. Of course, it is not integrated into the Meteor framework like Autoform is, but using it was far more easy than wrestling with Autoform in this case
There is not really a guide to use this in Meteor, but the basics are not hard. You can check here. I store the schema just in a JS object, and put it to the library when I need it. The form generated by this lib will just pop up in a DIV. You can puth a JSON object along with it to fill it with data, and pick it up on submit. You can than use the result to object your data in you Meteor app. I found the examples very usefull.
If you need more pointers, you know where to find me
So if I wanted users to be able to create additional forms on top of the standard one, I’d probably like to use your approach instead of trying to define a schema on instance of document or something?
no, there is no repro, but you can just download the JS and put it in your project; it’s easy. (I put it in /client/js.
I use the “array” type extensively, and that you can (re)order. I don’t know if it will fit your needs; you really need to try yourself.