I plan to build a dynamic schema and create an autoform from that schema. In the template where the form will be displayed I plan on doing this in
template.formPage.onCreated(function(){//do stuff});
What I am curious about though is getting the form onto the page:
Can I just use the usual AutoForm helper to generate the form directly in the template ie quickForm or would I need to create a new template helper to pass details from the newly created schema to the template?
Bit confused about what's supposed to happen where.
To be more concise: the user can create a document called exercise for example: this would have a name field, a description field etc and they could also decide what the measurable units are, these are stored as sub documents, each sub document has 3 fields: name, value, unit. I created a schema and sub schema and this works fine.
The issue is that when a user is doing a workout they should be able to select an exercise from the collection of exercises (all of which are created by the admin) and from that data create a form (read schema) to upload a document to the workout collection.
The measurable values in the exercise document will describe what form fields are required in the workout form depending on what exercise is being performed.
Essentially the exercise collection is a collection of schemas.
Related
I'm on magnolia 6.2.15 and I need to generate data from some fields that users insert in a content detail subapp.
I thought about creating a subclass of magnolia "SaveDetailSubAppAction", in the "execute" method to do the job.
I can retrieve fields value but, how can I generate new fields data values and insert that in the form before validation and commit to jcr datasource?
Well you can't. Or rather you shouldn't. The form is means for user to enter the data. If you create data programatically, you either send it directly to the datasource or store it directly on the node that datasource operates on.
If you want to show generated data to user for approval prior saving, then you need to create custom field that would have the place for extra input and would react on user generated input directly prior to saving content.
Im looking to have a document, which contains a collection of references to other documents. Like a Project that has a collection of Users, but the entries are Reference types to users from the top level Users collection.
I can't see a way of adding a Reference type to a Collection, It looks like you must create a Document first and then have a field in that doc that is the reference to the user doc - but that is just adding extra work.
When getting the collection data, you will have to first get the Document in the collection, and then using the field for the reference get the User Document.
It would be far simpler to have a nested array of values.
What is the best way to store a collection of references ?
A Reference is a field type, and fields must be in documents. You indeed cannot add References directly to a collection. But from your description I don't think this requires extra dummy documents:
Im looking to have a document, which contains a collection of references to other documents. Like a Project that has a collection of Users, but the entries are Reference types to users from the top level Users collection.
This sounds like you have two top-levels collections: Projects and Users. A document under Projects then has a nested map of user references.
If I misunderstood your model, then indeed: you will need to create a document to store your references to users. This is inherent to the Firestore data model, and can't be changed.
I am building a testing app where admin can build up questions for each test, each test will have its own set of fields (text, drop down, checkboxes, radio...etc), so I was wondering if there is any Meteor package that can help me with the dynamic form generation?
I've checked aldeed: autoform but as far as I understood all form fields (schema) must be defined statically, while in my case it is dynamically generated, saved/ retrieved in/ from the tests collection, where I save each test along with its fields (label, type, min, max...etc). Thanks
Autoform could automatically create your form based on a schema as it uses simple schema (or alternatively collection2). You could store and update your schema in the DB serialized for example and then use it with parseJSON.
var schema = $.parseJSON(jsonFromDB);
CollectionSchema = new SimpleSchema(schema);
{{> quickForm schema=CollectionSchema}}
Not tested but I think it should work.
I'm using Visual Studio 2010 to create a dynamic data site with scaffolding according to: http://www.asp.net/web-forms/videos/aspnet-dynamic-data/your-first-scaffold-and-what-is-dynamic-data
The site displays a SQL table with an "Insert New Item" link, which takes you here:
I have another SQL table which holds some of the information already. I would like to add a function that is called when the user navigates away from the "account" field; the function will query the other SQL table and populate the fields that it already holds for that account.
I'm stuck on where to put the function and how to setup the account field to call it.
It's a couple of years since I did one of these so pardon the details being a bit short.
You can 'override' the default New Item form. In that you can pre-populate the fields with anything you want. I think you have to take care of the Save also, and of setting out the controls on the form and populating them (you've overridden the generated form after all).
Another possibility is to create a partial class which extends the Model class and populates it in a constructor extension (I remember doing various stuff with this technique). There might also be some extension points on the model Context (or whatever its called) which you can tap into - it's pretty flexible as I remember.
I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.