Removing Unspecified

From EPrints Documentation
Revision as of 10:52, 5 March 2014 by Libjlrs (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In EPrints when a field has a multiple choice set of values their is always an Unspecified value by default. Unspecified exists because their needs to be a mechanism in the interface way to not fill in an answer. This can often cause a lot of grief because "Unspecified" is not a very helpful term and it also looks plug ugly in your interface.

A couple of solutions exist:

Make the field required

My old personal favourite was to make the field "required" in the workflow by adding required="yes" to the workflow element:

<field ref="copyright" required='yes' />

Because you must have a value for this field in order to move to the next stage of the workflow Unspecified is removed. How ever this solution comes with its own problems. Because its a required field the input is now has a red star next to it. This alerts attention to the field and often confuses the users because they don't understand why the field is required. Also if you havent set a default value for the field and the user chooses not to fill it then the workflow will shout at them and not let them deposit the item until they have made a choice.

Change the phrase which the field is using

A much nicer but harder to find solution is to change the Unspecified phrase.

Note it is a bad idea to change the "lib/metafield:unspeficied" phrase because this changes the Unspecified phrase for every field. Since it crops up in lots of places you can't easily predict where users will see the phrase. However there is a field specific "Unspecified" which you can set. For sets and namedsets this takes the form of a string <dataset>_fieldopt_<fieldname>_

<epp:phrase id="eprint_fieldopt_course_information_course_code_">Please select...</epp:phrase>

Changes Unspecified for the eprint field course_information_cource_code to Please select...

NOTE: Namedsets the above advice holds true for namedsets too - although their standard phrases are somewhat different to 'set' ones. A normal namedset phrase reference is of the form <namedset>_typename_<value>, but to change 'UNSPECIFIED' for these, you must still use <dataset>_fieldopt_<fieldname>_ e.g.

<!-- 'UNDEFINED' value -->
<epp:phrase id="document_fieldopt_license_">No license</epp:phrase>
<!-- 'normal' values -->
<epp:phrase id="licenses_typename_cc_by_nd">Creative Commons Attribution No Derivatives (UK)</epp:phrase>
<epp:phrase id="licenses_typename_cc_by">Creative Commons Attribution (UK)</epp:phrase>