cancel
Showing results for 
Search instead for 
Did you mean: 

Create a form in share with fields of a custom metadata type

falcon
Champ in-the-making
Champ in-the-making
Hi all,
I want do a dashlet in Share to show a form that has the fields of a custom metadata.
For example, i have this in file web-client-config-custom.xml
<config evaluator="node-type" condition="my:new_property_type">
   <property-sheet>
      <show-property name="my:property"/>
   </property-sheet>
</config>

And mySmiley Tongueroperty is defined as d:text with a constraint list of values.

I also do in share the file web-framework-config-custom.xml that contains:

<config evaluator="node-type" condition="my:new_property_type">
        <forms>
         <form>
          <field-visibility>
                <show id="my:property"/>
          </field-visibility>
        </form>
      </forms>
</config>


And when I edit metadata in …share/page/site/melilla/edit-metadata?nodeRef=workspace://SpacesStore/(nodereference) I can see an selectable input of type mySmiley Tongueroperty.

I want to know how i do a similar dashlet (using /components/form if it´s possible) that show me the same form but when I give a type (in this case my:new_property_type) and not the node reference.

Thanks a lot
8 REPLIES 8

mikeh
Star Contributor
Star Contributor
Is your form designed to collect data and create new nodes? If so, then you can do that with the Forms Service in HEAD, something like:
components/form?itemKind=type&itemId=my:new_property_type&destination={destination}&mode=create&submitType=JSON&htmlid=${args.htmlid}
Where: destination is the nodeRef where you want your new type created, and htmlid is a unique HTML DOM Id for the form to sit in.

Note that you'll also need some client-side dependencies, including:
/share/components/form/form.js
and
/share/components/form/form.css
…as well as calling some client-side initialisation.

Best bet would be to take a look at the edit-metadata page and also grab the latest SVN code and look at modules/dod-5015-share/source/web/components/documentlibrary/dod5015-toolbar.js at the onNewContainer() function, which creates pop-up dialogs containing custom forms.

Thanks,
Mike

Do we also need to define a ftl file for taking user inputs and from where we are calling this Url:

components/form?itemKind=type&itemId=my:new_property_type&destination={destination}&mode=create&submitType=JSON&htmlid=${args.htmlid}

dannyl999
Champ in-the-making
Champ in-the-making
Just wanted to know if there were any updates to this problem.  I'm using Share 3.2 and, I have a similar problem.  Currently, to create a node with edited properties, I have to upload a file first, by either "Create Content" or "Upload".  Then, when the node is created and shown in the document library, I click on the "Inline Edit" action, which in turn gives me all the properties of my custom content type.

It's a two-step process, which means, if the user doesn't decide to inline edit the document, the document won't have all the required fields.  Even if I modified the code to make it so that when you upload or create content, you automatically go to the inline edit page, the user can still exit the browser, once again leaving the required fields empty.

Thank you for any help or suggestions.

mikeh
Star Contributor
Star Contributor
In v3.3G (released soon, or download from the nightly build server) you can specify an optional formid parameter in the Create Content entries in toolbar.get.config.xml., e.g.
      <content mimetype="text/plain" icon="plain-text" label="menu.create-content.my-custom-type" formid="my-custom-form" />

Then create a new "model-type" form for "cm:content" with a formid that matches, e.g. something like:
   <config evaluator="model-type" condition="cm:content">
      <forms>
         <form id="my-custom-form">
            <field-visibility>
               <show id="cm:name" />
               <show id="cm:title" force="true" />
               …
               <show id="my:customField" force="true" />
               …
               etc.

Thanks,
Mike

manoj77
Champ in-the-making
Champ in-the-making
Hi I am trying to create a link within share preferably in the toolbar dropdown 'create-content' ( under the google docs document types ) to be able to create new types within share from a custom type.

Is it possible to extract the custom type properties automatically using the above example - changing toolbar.get.config.xml and then changing the share-config-custom.xml and display it in a form ?

Or do I need to build a form separately ?

Thanks,

Manoj

ruben_arjonilla
Champ in-the-making
Champ in-the-making
Hi all

I'm trying to create a document such as "my:customtype", and I modified the “toolbar.get.config.xml” file adding the following line:
<content mimetype="text/plain" icon="plain-text" label="menu.create-content.my-custom-type" formid="my-custom-form-id" />

And in the “share-config-custom.xml” file,  I added the following lines:

   <config evaluator="model-type" condition="my:customtype">
      <forms>
         <form id="my-custom-form-id">
            <field-visibility>
                 <show id="cm:name" />
               <show id="cm:title" force="true" />
               <show id="my:customField" force="true" />
            </field-visibility>
            <appearance>
               <field id="cm:name"/>
               <field id="cm:title"/>
               <field id="my:customField" label="My custom field"/>
            </appearance>
         </form>
      </forms>
   </config>

But when I go to Create content and select the new option added to “toolbar.get.config.xml” file, it opens the page create content with the cm:content form instead of my custom form with id=my-custom-form-id.

Do I need to change any other file so that share recognize my form so i can create a document of my:customtype?

Are there any other method to create a document of my:customtype from share?

Can I access to a URL with parameters to open my custom form to create a document of my:customtype?

Is there any problem if my:customtype only has metadata?

Thanks and regards and sorry for my english

ptvnrao
Champ in-the-making
Champ in-the-making
hi all,
i have created dashlet in share with a form how i can manage that form with another forms in share…give me help please..
thanks in advace

romschn
Star Collaborator
Star Collaborator
What do you mean by - manage that form with another forms in share ?