Using Forms service for webscript actions
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2012 07:34 AM
I'm using the Share forms service to render a Form, the form collects data that is posted to a webscript and processed.
The data in the form is not persisted against a node, so I have no data model for the form fields.
What I have done is define the form (shortened here)
The reason for defining it as a "cm:content" although it actually is not is the necessity for the forms service to have a forms processor. And it works (partly), the form is displayed as expected, I can post the json data and process it.
What is NOT working is constraints, if I set any field to Mandatory, that is gracefully ignored. Or have the file object picker start at correct location.
What I want to do
Define a form definition, it should not be dependent on any object, action or workflow. It is processed against a new FormProcessor that basically just returns whats thrown at it in form definition.
- I need to extend FilteredFormProcessor. What methods of the abstract methods of my new form processer needs to be implemented?
- What do I need for (if anything) in the form processor for object picker to work?
Maybe there is some entirely different way of doing this. But I like to use the forms service, I have already created custom controls for my need, so I dont want to use an 3rd party forms engine, with the Alfresco one I get so much by default (like validation).
The data in the form is not persisted against a node, so I have no data model for the form fields.
What I have done is define the form (shortened here)
<config evaluator="model-type" condition="cm:content"> <forms> <form id="printorder"> <field-visibility> <show id="sendto" force="true" /> <show id="contact" force="true" /> <show id="bestdata-objnr" force="true" /> <show id="bestdata-objnamn" force="true" />…. <appearance> <field id="bestdata-objnr" label-id="label.printorder.bestdata-objnr" mandatory="true" set="copyfirm"> <control template="/org/alfresco/components/form/controls/textfield.ftl" /> </field> <field id="bestdata-objnamn" label-id="label.printorder.bestdata-objnamn" set="copyfirm" mandatory="true"> <control template="/org/alfresco/components/form/controls/textfield.ftl" /> </field>
and then calling it with var templateUrl = YAHOO.lang.substitute( Alfresco.constants.URL_SERVICECONTEXT + "components/form?itemKind={itemKind}&itemId={itemId}" + "&mode={mode}&submitType={submitType}&formId={formId}&showCancelButton=true", { itemKind : "type", itemId : "cm:content", mode : "create", submitType : "json", formId : "printorder" });
The displayed form is then posted to a custom webservice url, not the default form processor.The reason for defining it as a "cm:content" although it actually is not is the necessity for the forms service to have a forms processor. And it works (partly), the form is displayed as expected, I can post the json data and process it.
What is NOT working is constraints, if I set any field to Mandatory, that is gracefully ignored. Or have the file object picker start at correct location.
What I want to do
Define a form definition, it should not be dependent on any object, action or workflow. It is processed against a new FormProcessor that basically just returns whats thrown at it in form definition.
- I need to extend FilteredFormProcessor. What methods of the abstract methods of my new form processer needs to be implemented?
- What do I need for (if anything) in the form processor for object picker to work?
Maybe there is some entirely different way of doing this. But I like to use the forms service, I have already created custom controls for my need, so I dont want to use an 3rd party forms engine, with the Alfresco one I get so much by default (like validation).
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2013 10:18 PM
Loftux,
I know this is a relatively old post but have you tried using Alfresco.util.PopupManager.displayForm()? For a sample on how to use it click here. Just pass it your properties for formId, itemId, itemKind, and mode.
I hope this helps. Cheers.
I know this is a relatively old post but have you tried using Alfresco.util.PopupManager.displayForm()? For a sample on how to use it click here. Just pass it your properties for formId, itemId, itemKind, and mode.
I hope this helps. Cheers.
