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.
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>
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.
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
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.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.