<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?action=history&amp;feed=atom&amp;title=Field_validate.pl</id>
	<title>Field validate.pl - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?action=history&amp;feed=atom&amp;title=Field_validate.pl"/>
	<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;action=history"/>
	<updated>2026-05-10T13:59:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14368&amp;oldid=prev</id>
		<title>Drn@ecs.soton.ac.uk: Added actually file name in bold.</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14368&amp;oldid=prev"/>
		<updated>2022-01-30T10:13:46Z</updated>

		<summary type="html">&lt;p&gt;Added actually file name in bold.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:13, 30 January 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{cfgd}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{cfgd}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This file &lt;/del&gt;contains configuration for a generalised validating metadata fields within a data object with the &#039;&#039;&#039;validate_field&#039;&#039;&#039; function.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;field_validate.pl&#039;&#039;&#039; &lt;/ins&gt;contains configuration for a generalised validating metadata fields within a data object with the &#039;&#039;&#039;validate_field&#039;&#039;&#039; function.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Example ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Drn@ecs.soton.ac.uk</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14278&amp;oldid=prev</id>
		<title>Drn@ecs.soton.ac.uk at 12:27, 23 January 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14278&amp;oldid=prev"/>
		<updated>2022-01-23T12:27:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:27, 23 January 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are email addresses if the field type is [[API:EPrints/MetaField/Email|EPrints::MetaField::Email]].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are email addresses if the field type is [[API:EPrints/MetaField/Email|EPrints::MetaField::Email]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are no longer than the &amp;lt;tt&amp;gt;maxlength&amp;lt;/tt&amp;gt; attribute for the field.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are no longer than the &amp;lt;tt&amp;gt;maxlength&amp;lt;/tt&amp;gt; attribute for the field.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;lt;tt&amp;gt;username&amp;lt;/tt&amp;gt; is being changed on a [[API:EPrints/DataObj/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Email&lt;/del&gt;|EPrints::DataObj::User]] data object and this will lead it to have the same username as another user. (Unless EPrints &amp;lt;tt&amp;gt;allow_duplicate_usernames&amp;lt;/tt&amp;gt; configuration allows this).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;lt;tt&amp;gt;username&amp;lt;/tt&amp;gt; is being changed on a [[API:EPrints/DataObj/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;User&lt;/ins&gt;|EPrints::DataObj::User]] data object and this will lead it to have the same username as another user. (Unless EPrints &amp;lt;tt&amp;gt;allow_duplicate_usernames&amp;lt;/tt&amp;gt; configuration allows this).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  $c-&amp;gt;{validate_field} = sub&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  $c-&amp;gt;{validate_field} = sub&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Drn@ecs.soton.ac.uk</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14277&amp;oldid=prev</id>
		<title>Drn@ecs.soton.ac.uk at 12:26, 23 January 2022</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14277&amp;oldid=prev"/>
		<updated>2022-01-23T12:26:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:26, 23 January 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following example checks if the value(s) of a metadata field:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following example checks if the value(s) of a metadata field:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are &amp;#039;loosely&amp;#039; URLs if the field type is [[API:EPrints/MetaField/Url|EPrints::MetaField::URL]].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are &amp;#039;loosely&amp;#039; URLs if the field type is [[API:EPrints/MetaField/Url|EPrints::MetaField::URL]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Have both a non-empty &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&lt;/del&gt;family&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039; &lt;/del&gt;and &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&lt;/del&gt;given&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039; &lt;/del&gt;sub-field if the field is of type [[API:EPrints/MetaField/Name|EPrints::MetaField::Name]].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Have both a non-empty &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;family&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt; &lt;/ins&gt;and &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;given&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt; &lt;/ins&gt;sub-field if the field is of type [[API:EPrints/MetaField/Name|EPrints::MetaField::Name]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Email &lt;/del&gt;addresses if the field type is [[API:EPrints/MetaField/Email|EPrints::MetaField::Email]].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;email &lt;/ins&gt;addresses if the field type is [[API:EPrints/MetaField/Email|EPrints::MetaField::Email]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are no longer than the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&lt;/del&gt;maxlength&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039; attibute &lt;/del&gt;for the field.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Are no longer than the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;maxlength&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt; attribute &lt;/ins&gt;for the field.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&lt;/del&gt;username&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039; &lt;/del&gt;is being changed on a &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;user&#039;&#039; &lt;/del&gt;data object and this will lead it to have the same username as another user. (Unless EPrints &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&lt;/del&gt;allow_duplicate_usernames&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039; &lt;/del&gt;configuration allows this).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;username&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt; &lt;/ins&gt;is being changed on a &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[API:EPrints/DataObj/Email|EPrints::DataObj::User]] &lt;/ins&gt;data object and this will lead it to have the same username as another user. (Unless EPrints &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;tt&amp;gt;&lt;/ins&gt;allow_duplicate_usernames&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/tt&amp;gt; &lt;/ins&gt;configuration allows this).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  $c-&amp;gt;{validate_field} = sub&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  $c-&amp;gt;{validate_field} = sub&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Drn@ecs.soton.ac.uk</name></author>
	</entry>
	<entry>
		<id>https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14276&amp;oldid=prev</id>
		<title>Drn@ecs.soton.ac.uk: Added page about config file</title>
		<link rel="alternate" type="text/html" href="https://wiki.ext-9.eprints-hosting.org/w/index.php?title=Field_validate.pl&amp;diff=14276&amp;oldid=prev"/>
		<updated>2022-01-23T12:23:55Z</updated>

		<summary type="html">&lt;p&gt;Added page about config file&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{dirs}}&lt;br /&gt;
{{cfgd}}&lt;br /&gt;
&lt;br /&gt;
This file contains configuration for a generalised validating metadata fields within a data object with the &amp;#039;&amp;#039;&amp;#039;validate_field&amp;#039;&amp;#039;&amp;#039; function.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
The following example checks if the value(s) of a metadata field:&lt;br /&gt;
# Are &amp;#039;loosely&amp;#039; URLs if the field type is [[API:EPrints/MetaField/Url|EPrints::MetaField::URL]].&lt;br /&gt;
# Have both a non-empty &amp;#039;&amp;#039;family&amp;#039;&amp;#039; and &amp;#039;&amp;#039;given&amp;#039;&amp;#039; sub-field if the field is of type [[API:EPrints/MetaField/Name|EPrints::MetaField::Name]].&lt;br /&gt;
# Are Email addresses if the field type is [[API:EPrints/MetaField/Email|EPrints::MetaField::Email]].&lt;br /&gt;
# Are no longer than the &amp;#039;&amp;#039;maxlength&amp;#039;&amp;#039; attibute for the field.&lt;br /&gt;
# &amp;#039;&amp;#039;username&amp;#039;&amp;#039; is being changed on a &amp;#039;&amp;#039;user&amp;#039;&amp;#039; data object and this will lead it to have the same username as another user. (Unless EPrints &amp;#039;&amp;#039;allow_duplicate_usernames&amp;#039;&amp;#039; configuration allows this).&lt;br /&gt;
 $c-&amp;gt;{validate_field} = sub&lt;br /&gt;
 {&lt;br /&gt;
   my( $field, $value, $repository, $for_archive ) = @_;&lt;br /&gt;
 &lt;br /&gt;
   my $xml = $repository-&amp;gt;xml();&lt;br /&gt;
 &lt;br /&gt;
   # only apply checks if the value is set&lt;br /&gt;
   return () if !EPrints::Utils::is_set( $value );&lt;br /&gt;
 &lt;br /&gt;
   my @problems = ();&lt;br /&gt;
 &lt;br /&gt;
   # CHECKS IN HERE&lt;br /&gt;
 &lt;br /&gt;
   my $values = ref($value) eq &amp;quot;ARRAY&amp;quot; ? $value : [$value];&lt;br /&gt;
 &lt;br /&gt;
   # closure for generating the field link fragment&lt;br /&gt;
   my $f_fieldname = sub {&lt;br /&gt;
     my $f = defined $field-&amp;gt;property( &amp;quot;parent&amp;quot; ) ? $field-&amp;gt;property( &amp;quot;parent&amp;quot; ) : $field;&lt;br /&gt;
     my $fieldname = $xml-&amp;gt;create_element( &amp;quot;span&amp;quot;, class=&amp;gt;&amp;quot;ep_problem_field:&amp;quot;.$f-&amp;gt;get_name );&lt;br /&gt;
     $fieldname-&amp;gt;appendChild( $f-&amp;gt;render_name( $repository ) );&lt;br /&gt;
     return $fieldname;&lt;br /&gt;
   };&lt;br /&gt;
 &lt;br /&gt;
   # Loop over actual individual values to check URLs, names and emails&lt;br /&gt;
   foreach my $v (@$values)&lt;br /&gt;
   {&lt;br /&gt;
     next unless EPrints::Utils::is_set( $v );&lt;br /&gt;
 &lt;br /&gt;
     if( $field-&amp;gt;isa( &amp;quot;EPrints::MetaField::Url&amp;quot; ) )&lt;br /&gt;
     {&lt;br /&gt;
       # Valid URI check (very loose)&lt;br /&gt;
       if( $v !~ /^\w+:/ )&lt;br /&gt;
       {&lt;br /&gt;
         push @problems, $repository-&amp;gt;html_phrase( &amp;quot;validate:missing_http&amp;quot;, fieldname=&amp;gt;&amp;amp;$f_fieldname );&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     elsif( $field-&amp;gt;isa( &amp;quot;EPrints::MetaField::Name&amp;quot; ) )&lt;br /&gt;
     {&lt;br /&gt;
       # Check a name has a family part&lt;br /&gt;
       if( !EPrints::Utils::is_set( $v-&amp;gt;{family} ) )&lt;br /&gt;
       {&lt;br /&gt;
         push @problems, $repository-&amp;gt;html_phrase( &amp;quot;validate:missing_family&amp;quot;, fieldname=&amp;gt;&amp;amp;$f_fieldname );&lt;br /&gt;
       }&lt;br /&gt;
       # Check a name has a given part&lt;br /&gt;
       elsif( !EPrints::Utils::is_set( $v-&amp;gt;{given} ) )&lt;br /&gt;
       {&lt;br /&gt;
         push @problems, $repository-&amp;gt;html_phrase( &amp;quot;validate:missing_given&amp;quot;, fieldname=&amp;gt;&amp;amp;$f_fieldname );&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     elsif( $field-&amp;gt;isa( &amp;quot;EPrints::MetaField::Email&amp;quot; ) )&lt;br /&gt;
     {&lt;br /&gt;
       # Check an email looks &amp;quot;ok&amp;quot;. Just checks it has only one &amp;quot;@&amp;quot; and no&lt;br /&gt;
       # spaces.&lt;br /&gt;
       if( $v !~ /^[^ \@]+\@[^ \@]+$/ )&lt;br /&gt;
       {&lt;br /&gt;
         push @problems,$repository-&amp;gt;html_phrase( &amp;quot;validate:bad_email&amp;quot;, fieldname=&amp;gt;&amp;amp;$f_fieldname );&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     # Check for overly long values&lt;br /&gt;
     # Applies to all subclasses of Id: Text, Longtext, Url etc.&lt;br /&gt;
     if( $field-&amp;gt;isa( &amp;quot;EPrints::MetaField::Id&amp;quot; ) )&lt;br /&gt;
     {&lt;br /&gt;
       if( EPrints::Utils::is_set( $v ) &amp;amp;&amp;amp; length($v) &amp;gt; $field-&amp;gt;property( &amp;quot;maxlength&amp;quot; ) )&lt;br /&gt;
       {&lt;br /&gt;
         push @problems, $repository-&amp;gt;html_phrase( &amp;quot;validate:truncated&amp;quot;, fieldname=&amp;gt;&amp;amp;$f_fieldname );&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     # Unless duplicate usernames are explicitly permitted do not allow username to be changed to that of an existing user&lt;br /&gt;
     if ( $field-&amp;gt;get_name eq &amp;quot;username&amp;quot; &amp;amp;&amp;amp; $field-&amp;gt;dataset-&amp;gt;id eq &amp;quot;user&amp;quot; &amp;amp;&amp;amp; defined $repository-&amp;gt;param( &amp;#039;dataobj&amp;#039; ) &amp;amp;&amp;amp; !$repository-&amp;gt;config( &amp;quot;allow_duplicate_usernames&amp;quot; ) )&lt;br /&gt;
     {&lt;br /&gt;
       my $user_with_username = EPrints::DataObj::User::user_with_username( $repository, $v );&lt;br /&gt;
       my $current_user = $field-&amp;gt;dataset-&amp;gt;dataobj( $repository-&amp;gt;param( &amp;#039;dataobj&amp;#039; ) );&lt;br /&gt;
       if ( $user_with_username-&amp;gt;id ne $current_user-&amp;gt;id )&lt;br /&gt;
       {&lt;br /&gt;
         push @problems, $repository-&amp;gt;html_phrase( &amp;quot;validate:duplicate_username&amp;quot;, username =&amp;gt; $repository-&amp;gt;make_text( $v ) );&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   return( @problems );&lt;br /&gt;
 };&lt;/div&gt;</summary>
		<author><name>Drn@ecs.soton.ac.uk</name></author>
	</entry>
</feed>