10-13-2022 12:23 PM
Hello,
Using `/share/service/components/form` web script we can render a form for a node or for a type. Is it posible to render a form for a type with aspects? If no, how would you implement it?
I can implement "AspectFormProcessor", but what next? How to connect it with the Alfresco Share?
It would be the best to specify properties in the request's argument and render a form with only those.
10-14-2022 03:16 AM
You can render forms for aspects in Share. A good sample is available in
<config evaluator="aspect" condition="sc:webable"> <forms> <form> <field-visibility> <show id="sc:published" /> <show id="sc:isActive" /> </field-visibility> <appearance> <field id="sc:published" label-id="prop.sc_published" /> <field id="sc:isActive" label-id="prop.sc_isActive" /> </appearance> </form> </forms> </config>
10-14-2022 05:04 AM
Hi @angelborroy
thank you for the answer, I am very well aware of that configuration but I'm wondering how to render an HTML form based on i.e. type "cm:content" and aspects "sc:webable" and "cmrojectsummary". So in that example, I want to render an HTML form containing a properties from the cm:content type and properties from both "sc:webable" and "cmrojectssummary" aspects. The simpliest solution I found so far it to create a dummy node containing that type and aspects and then call `/share/service/components/form` web script with "node" itemKind.
But it seems to be a bit dirty solution.
10-14-2022 05:11 AM
If the node of type "cm:content" has "sc:webable" and "cmrojectsummary" aspect set, the form will include all the properties for node and types.
If you want to create a new node and show a form with these properties, you can try an approach similar to https://github.com/softwareloop/uploader-plus
10-14-2022 09:10 AM
It is all about a new node. In the uploader-plus addon, only type can be selected (because there is no such think as PropertyFormProcessor or AspectFormProcessor, there is only NodeFormProcessor and TypeFormProcessor). I'm trying to add a functionality to select also an aspect or a property.
For example:
Input:
type=cm:content and aspects=[my:test, my:test2]
GET /share/service/components/form?type=cm:content&aspects=[my:test, my:test2]
Output:
<rendered HTML form>
<form> <input type="text" name="prop_cm_name"> <input type="text" name="prop_cm_title"> <input type="text" name="prop_cm_description"> ... <input type="text" name="prop_my_test_prop1"> <input type="text" name="prop_my_test_prop2"> <input type="text" name="prop_my_test2_prop1"> </form>
I would like to use existing Share's type and aspect form configuration.
I can of course write my own Share web script, I'm just wondering if there is an easier way.
Explore our Alfresco products with the links below. Use labels to filter content by product module.