Difference between revisions of "Files/Validate Plugin"

From EPrints Documentation
Jump to: navigation, search
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category:EPrints 3 Plugins]]
 
This plugin will become part of EPrints 3.1, possibly even a 3.0.x
 
This plugin will become part of EPrints 3.1, possibly even a 3.0.x
 +
 +
Download it from: http://files.eprints.org/293/
  
 
It allows you to specify validation errors in the workflow.
 
It allows you to specify validation errors in the workflow.
  
<nowiki>
+
<nowiki>
 
  <component type="Validate">
 
  <component type="Validate">
 
   <epc:if test="!is_set(creators) and !is_set(editors)">
 
   <epc:if test="!is_set(creators) and !is_set(editors)">
       <error><span class="ep_problem_field:creators">Creators</span> or <span class="ep_problem_field:editors">Editors</span> must be set.</error>
+
       <error><span class="ep_problem_field:creators">Creators</span>  
   <epc:if>
+
or <span class="ep_problem_field:editors">Editors</span> must be set.</error>
 +
   </epc:if>
 
   <epc:if test="length(subjects) gt 5">
 
   <epc:if test="length(subjects) gt 5">
       <error>You have selected <epc:print expr="length(subjects)" /> <span class="ep_problem_field:subjects">subjects</span>, but there is a maximum of 5 allowed.</error>
+
       <error>You have selected <epc:print expr="length(subjects)" />  
   <epc:if>
+
<span class="ep_problem_field:subjects">subjects</span>, but there is a maximum  
 +
of 5 allowed.</error>
 +
   </epc:if>
 
  </component>
 
  </component>
 
</nowiki>
 
</nowiki>
  
 
Don't put the if's inside the (error) blocks as they will still cause a validation failure even if they contain no text.
 
Don't put the if's inside the (error) blocks as they will still cause a validation failure even if they contain no text.

Latest revision as of 17:44, 9 February 2010

This plugin will become part of EPrints 3.1, possibly even a 3.0.x

Download it from: http://files.eprints.org/293/

It allows you to specify validation errors in the workflow.

 <component type="Validate">
   <epc:if test="!is_set(creators) and !is_set(editors)">
      <error><span class="ep_problem_field:creators">Creators</span> 
or <span class="ep_problem_field:editors">Editors</span> must be set.</error>
   </epc:if>
   <epc:if test="length(subjects) gt 5">
      <error>You have selected <epc:print expr="length(subjects)" /> 
<span class="ep_problem_field:subjects">subjects</span>, but there is a maximum 
of 5 allowed.</error>
   </epc:if>
 </component>

Don't put the if's inside the (error) blocks as they will still cause a validation failure even if they contain no text.