Converting field to dropdown.

Hey all.

When editing metadata in INSPIRE view, there is a section called “Restrictions on access and use”, which contains textfield entries for “Access constraints”.

I would like to convert this textfield into dropdown with values selectable from some codelist.

  1. What is the best way to modify the field in the config-editor.xml so the dropdown will be shown instead of the textfield?

This is the field (in config-editor), i’d like to convert this to dropdown:

          <field name="accessConstraints"
                 xpath="/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/
            gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints"
                 if="count(gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification) > 0"/>
  1. Where do i store the codelist entries? In the codelists.xml?

Thanks!

Hi

An option is to use a vocabulary with the values you require, you could add a similar configuration to this one, but for the field gmd:otherConstraints in the fields section:

 <for name="gmd:otherConstraints"
      xpath="/gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints"
         use="data-gn-keyword-picker">
      <directiveAttributes data-thesaurus-key="external.theme.httpinspireeceuropaeumetadatacodelistLimitationsOnPublicAccess-LimitationsOnPublicAccess"/>
    </for>

You need to change the value external.theme.httpinspireeceuropaeumetadatacodelistLimitationsOnPublicAccess-LimitationsOnPublicAccess with the identifier of your vocabulary.

The downside of this approach is that the user will be able also to write other values than the ones defined in the vocabulary.


To show a fixed select control, I’m afraid that will require some xslt development.

Here is an example, you don’t need to change config-editor.xml, but add a template similar to this one, but for your field:

Storing the values with a custom identifier in the codelist.xml, similar as the codelist for the previous example: