ldapsaisie/src/includes/js/LSformElement_text.js

59 lines
1.6 KiB
JavaScript
Raw Normal View History

var LSformElement_text = new Class({
initialize: function(){
this.elements = new Hash();
this.initialiseLSformElement_text();
if ($type(varLSform)) {
varLSform.addModule("LSformElement_text",this);
}
},
2020-04-29 15:54:21 +02:00
initialiseLSformElement_text: function(el) {
if (typeof(el) == 'undefined') {
el = document;
}
var getName = /^(.*)\[\]$/;
el.getElements('input.LSformElement_text').each(function(input) {
var name = getName.exec(input.name)[1];
if (!$type(this.elements[name])) {
this.elements[name] = new Hash();
}
2020-04-29 15:54:21 +02:00
var id = this.elements[name].getLength();
this.elements[name][id] = new LSformElement_text_field(name,input,this);
}, this);
this.elements.each(function(element) {
element.each(function(field) {
field.start.bind(field)();
},this);
},this);
},
2020-04-29 15:54:21 +02:00
reinitialize: function(el) {
this.initialiseLSformElement_text(el);
},
2020-04-29 15:54:21 +02:00
getDependsFields: function(format) {
var retval=new Array();
var find = 1;
var getMotif = new RegExp('%\{(([A-Za-z0-9]+)(\:(-?[0-9])+)?(\:(-?[0-9])+)?([\!\_\~\%]+)?)\}');
var ch = null;
while (find) {
ch = getMotif.exec(format);
if ($type(ch)) {
retval.include(ch[2]);
format=format.replace (
new RegExp('%\{'+ch[1]+'\}'),
''
);
}
else {
find=0;
2020-04-29 15:54:21 +02:00
}
}
return retval;
}
2020-04-29 15:54:21 +02:00
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSformElement_text = new LSformElement_text();
});