Difference between revisions of "Removing Unspecified"

From EPrints Documentation
Jump to: navigation, search
(Added calrification for namedsets)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
[[Category:Howto]]
 
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.
 
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.
  
Line 5: Line 6:
 
==Make the field required==
 
==Make the field required==
 
My old personal favourite was to make the field "required" in the workflow by adding <code>required="yes"</code> to the workflow element:
 
My old personal favourite was to make the field "required" in the workflow by adding <code>required="yes"</code> to the workflow element:
<field ref="copyright" required='yes' />
+
<source lang="xml">
 +
<field ref="copyright" required='yes' />
 +
</source>
 
Because you must have a value for this field in order to move to the next stage of the workflow Unspecified is removed.  
 
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 dont understand why the field is required. Also if you havent set a default value for the field and the user choses not to fill it then the workflow will shout at them and not let them deposit the item untill they have made a choice.
+
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==
 
==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" 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>_
+
A much nicer but harder to find solution is to change the Unspecified phrase.  
  <epp:phrase id="eprint_fieldopt_course_information_course_code_">Please select...</epp:phrase>
+
 
 +
'''Note''' it is a '''bad idea''' to change the <code>"lib/metafield:unspeficied"</code> 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>_
 +
<source lang="xml">
 +
<epp:phrase id="eprint_fieldopt_course_information_course_code_">Please select...</epp:phrase>
 +
</source>
 
Changes Unspecified for the eprint field course_information_cource_code to Please select...
 
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.
 +
<source lang="xml">
 +
<!-- '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>
 +
...
 +
</source>

Latest revision as of 10:52, 5 March 2014

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>
...