}
}
return obj;
- }
+ },
+
+ RequiredField : function (f) {
+ if (!f) return;
+ if (fieldmapper.IDL && fieldmapper.IDL.loaded)
+ return this.Structure.fields[f].required;
+ return;
+ },
+
+ ValidateField : function (f) {
+ if (!f) return;
+ if (fieldmapper.IDL && fieldmapper.IDL.loaded) {
+ if (this.Structure.fields[f] && this.Structure.fields[f].validate) {
+ return this.Structure.fields[f].validate.test(this[f]());
+ }
+ return true;
+ }
+ return;
+ }
+
/*
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 valid = fieldmapper._getAttributeNS(node,this.NS_OBJ, 'validate');
+ if (valid) obj.validate = new RegExp( valid.replace(/\\/g, '\\\\') );
var permacrud = node.getElementsByTagName('permacrud')[0];
if(permacrud) {