<field reporter:label="Name" name="name" reporter:datatype="text" oils_persist:i18n="true"/>
<field reporter:label="Organizational Unit Type" name="ou_type" reporter:datatype="link"/>
<field reporter:label="Parent Organizational Unit" name="parent_ou" reporter:datatype="link"/>
- <field reporter:label="Short (Policy) Name" name="shortname" reporter:datatype="text"/>
+ <field reporter:label="Short (Policy) Name" name="shortname" reporter:datatype="text" oils_obj:required="true" oils_obj:validate="^[A-Z]+$"/>
<field reporter:label="Email Address" name="email" reporter:datatype="text"/>
<field reporter:label="Phone Number" name="phone" reporter:datatype="text"/>
<field reporter:label="OPAC Visible" name="opac_visible" reporter:datatype="bool"/>
attributeFormDefault="unqualified"
>
+<xs:attribute name="required"/>
+<xs:attribute name="validate"/>
<xs:attribute name="array_position" type="xs:nonNegativeInteger"/>
<xs:attribute name="fieldmapper"/>
my $name = get_attribute( $attribute_list, 'name' );
next if( $name eq 'isnew' || $name eq 'ischanged' || $name eq 'isdeleted' );
+ my $required = get_attribute( $attribute_list, 'oils_obj:required' );
+ my $validate = get_attribute( $attribute_list, 'oils_obj:validate' );
my $virtual = get_attribute( $attribute_list, 'oils_persist:virtual' );
if( ! defined( $virtual ) ) {
$virtual = "false";
$$fieldmap{$fm}{fields}{ $name } =
{ virtual => ( $virtual eq 'true' ) ? 1 : 0,
+ required => ( $required eq 'true' ) ? 1 : 0,
position => $array_position,
};
+ $$fieldmap{$fm}{fields}{ $name }{validate} = qr/$valudate/ if (defined($validate));
+
# The selector attribute, if present at all, attaches to only one
# of the fields in a given class. So if we see it, we store it at
# the level of the enclosing class.
label : fieldmapper._getAttributeNS(node,this.NS_REPORTS, 'label'),
restrict_primary : fieldmapper._getAttributeNS(node,this.NS_PERSIST, 'restrict_primary'),
virtual : (fieldmapper._getAttributeNS(node,this.NS_PERSIST, 'virtual') == 'true'),
+ required : (fieldmapper._getAttributeNS(node,this.NS_OBJ, 'required') == 'true'),
pkey : fieldmapper._getAttributeNS(fields,this.NS_PERSIST, 'primary'),
pkey_sequence : fieldmapper._getAttributeNS(fields,this.NS_PERSIST, 'sequence')
};
+ var valid = fieldmapper._getAttributeNS(node,this.NS_OBJ, 'validate');
+ if (valid) obj.validate = new RegExp( valid );
+
var permacrud = node.getElementsByTagName('permacrud')[0];
if(permacrud) {
var actions = ['create', 'retrieve', 'update', 'delete'];