Brendow Adriel
Brendow Adriel

Reputation: 434

How to customize submit forms in Dspace?

I use XMLUI in DSpace 5.5, it is possible to customize the HTML submission form? Has any file in dspace to allow this?

Upvotes: 0

Views: 2632

Answers (2)

Abdollah
Abdollah

Reputation: 5177

For example, if you want to add a Gender drop-down with options: "N/A", "Male" and "Female" to the first page (step) of the submission form, you need to add a proper field to a Metadata Schema and modify UI accordingly. Do these steps in the XML UI. Sign in as an administrator. In the context menu, under ADMINISTRATIVE, Registries, go to Metadata. It is highly recommended to use local metadata schema when you want to add a metadata field to DSpace. Each metadata field (including built-in or custom) comprises 3 parts: schema, element, and qualifier. For example in field dc.contributor.author, dc is schema, contributor is element, and author is qualifier. In our example the field can be defined as local.contributor.gender, so local is schema, contributor is element, and gender is qualifier. In Metadata registry page, click on local so you see the fields defined in local schema and the following inputs to add new fields to the schema:

enter image description here

As you see, there is no need to type the schema part i.e. local and just type contributor and gender in the specified inputs. You can also add a note in Scope Note. Click on Add new metadata field to save the field.

Now the UI time! Edit file [dspace-source]/dspace/config/input-forms.xml as follows. Look at this part of the file:

<form-definitions>
   <form name="traditional">
     <page number="1">
         <field ...>
         <field ...>
         ...
     </page>
   </form>
<form-definitions>

Add the following <field> element along with the other <field> elements:

   <field>
     <dc-schema>local</dc-schema>
     <dc-element>contributor</dc-element>
     <dc-qualifier>gender</dc-qualifier>
     <repeatable>false</repeatable>
     <label>Gender</label>
     <input-type value-pairs-name="common_gender_contributor">dropdown</input-type>
     <hint>Select the gender of the author.</hint>
     <required></required>
   </field>

This document, explains each of the above sub-elements:

  • dc-schema (Required) : Name of metadata schema employed.
  • dc-element (Required) : Name of the Dublin Core element entered in this field, e.g. contributor.
  • dc-qualifier: Qualifier of the Dublin Core element entered in this field, e.g. when the field is contributor.advisor the value of this element would be advisor. Leaving this out means the input is for an unqualified DC element.
  • repeatable: Value is true when multiple values of this field are allowed, false otherwise.
  • label (Required): Text to display as the label of this field, describing what to enter, e.g. "Your Advisor's Name".
  • input-type(Required): Defines the kind of interactive widget to put in the form to collect the Dublin Core value. Content must be one of the following keywords:
    • onebox – A single text-entry box.
    • dropdown – Choose value(s) from a "drop-down" menu list. Note: You must also include a value for the value-pairs-name attribute to specify a list of menu entries from which to choose.
    • ...
  • hint (Required): Content is the text that will appear as a "hint", or instructions, next to the input fields.
  • required: When this element is included with any content, it marks the field as a required input.

Since the widget is a drop-down, the element <input-type> has been defined like this:

<input-type value-pairs-name="common_gender_contributor">dropdown</input-type>

common_gender_contributor is the name of a <value-pairs> element that is defined as follows:

<value-pairs value-pairs-name="common_gender_contributor"
             dc-term="">
    <pair>
        <displayed-value>N/A</displayed-value>
        <stored-value/>
    </pair>   
    <pair>
        <displayed-value>Male</displayed-value>
        <stored-value>male</stored-value>
    </pair>
    <pair>
        <displayed-value>Female</displayed-value>
        <stored-value>female</stored-value>
    </pair>     
</value-pairs>

The <value-pairs> element is placed under <form-value-pairs> element, along with the other <value-pairs> elements in file [dspace-source]/dspace/config/input-forms.xml. Rebuild DSpace and you see the new drop-down in the submission page.

Upvotes: 2

terrywb
terrywb

Reputation: 3956

The input form customizations are set in https://github.com/DSpace/DSpace/blob/master/dspace/config/input-forms.xml

See https://wiki.duraspace.org/display/DSDOC5x/Submission+User+Interface for documentation of the process.

Upvotes: 3

Related Questions