2008-07-28 18:30:40 +02:00
|
|
|
var LSformElement_text = new Class({
|
|
|
|
initialize: function(){
|
2008-10-15 19:40:04 +02:00
|
|
|
this.elements = new Hash();
|
2008-07-28 18:30:40 +02:00
|
|
|
this.initialiseLSformElement_text();
|
2008-10-15 19:40:04 +02:00
|
|
|
if ($type(varLSform)) {
|
|
|
|
varLSform.addModule("LSformElement_text",this);
|
|
|
|
}
|
2008-07-28 18:30:40 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
initialiseLSformElement_text: function(el) {
|
2008-10-15 19:40:04 +02:00
|
|
|
|
2008-07-28 18:30:40 +02:00
|
|
|
if (typeof(el) == 'undefined') {
|
|
|
|
el = document;
|
|
|
|
}
|
|
|
|
var getName = /^(.*)\[\]$/
|
2008-10-15 19:40:04 +02:00
|
|
|
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();
|
2008-07-28 18:30:40 +02:00
|
|
|
}
|
2008-10-15 19:40:04 +02:00
|
|
|
var id = this.elements[name].getLength();
|
|
|
|
this.elements[name][id] = new LSformElement_text_field(name,input,this);
|
2008-07-28 18:30:40 +02:00
|
|
|
}, this);
|
2008-10-15 19:40:04 +02:00
|
|
|
this.elements.each(function(element) {
|
|
|
|
element.each(function(field) {
|
|
|
|
field.start.bind(field)();
|
|
|
|
},this);
|
2008-07-28 18:30:40 +02:00
|
|
|
},this);
|
|
|
|
},
|
|
|
|
|
2008-10-15 19:40:04 +02:00
|
|
|
reinitialize: function(el) {
|
|
|
|
this.initialiseLSformElement_text(el);
|
|
|
|
},
|
|
|
|
|
2008-07-28 18:30:40 +02:00
|
|
|
getDependsFields: function(format) {
|
|
|
|
var retval=new Array();
|
|
|
|
var find = 1;
|
2019-01-30 15:50:51 +01:00
|
|
|
var getMotif = new RegExp('%\{(([A-Za-z0-9]+)(\:(-?[0-9])+)?(\:(-?[0-9])+)?([\!\_\~\%]+)?)\}');
|
2008-07-28 18:30:40 +02:00
|
|
|
var ch = null;
|
|
|
|
while (find) {
|
|
|
|
ch = getMotif.exec(format);
|
|
|
|
if ($type(ch)) {
|
2008-10-27 15:15:05 +01:00
|
|
|
retval.include(ch[2]);
|
2008-07-28 18:30:40 +02:00
|
|
|
format=format.replace (
|
2008-07-28 19:06:40 +02:00
|
|
|
new RegExp('%\{'+ch[1]+'\}'),
|
2008-07-28 18:30:40 +02:00
|
|
|
''
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
find=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
|
|
|
varLSformElement_text = new LSformElement_text();
|
|
|
|
});
|