ldapsaisie/trunk/includes/js/LSformElement_text.js
Benjamin Renard 1228e42fc7 - function.js :
-> création d'un fichier functions.js pour extraire la partie LSdebug de
  LSdefault.js.
  -> création d'une méthode getFData() sensiblement la même quand PHP
- LSformElement_text : Création d'une possibilité d'auto-génération en JS de la
  valeur à partir des autres champs du formulaire.
- LSconfirmBox && LSsmoothbox :
  -> ajout d'une méthode positionWhenScrolling() pour le placement de la box
  lors du scroll
- LSconfirmBox : Correction d'un bug IE à la fermeture
2008-07-28 16:30:40 +00:00

56 lines
1.5 KiB
JavaScript

var LSformElement_text = new Class({
initialize: function(){
this.fields = new Hash();
this.initialiseLSformElement_text();
},
initialiseLSformElement_text: function(el) {
if (typeof(el) == 'undefined') {
el = document;
}
var getName = /^(.*)\[\]$/
el.getElements('ul.LSformElement_text').each(function(ul) {
var first = ul.getElement('input.LSformElement_text');
if ($type(first)) {
var name = getName.exec(first.name)[1];
this.fields[name] = new LSformElement_text_field(name,first,this);
}
}, this);
this.fields.each(function(el) {
el.start.bind(el)();
},this);
},
getDependsFields: function(format) {
var retval=new Array();
var find = 1;
var getMotif = /%{([A-Za-z0-9]+)}/
var ch = null;
while (find) {
ch = getMotif.exec(format);
if ($type(ch)) {
retval.include(ch[1]);
format=format.replace (
new RegExp('%{'+ch[1]+'}'),
''
);
}
else {
find=0;
}
}
return retval;
},
getInput: function(name) {
return this.fields[name].getInput();
},
getValue: function(name) {
return this.fields[name].getValue();
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSformElement_text = new LSformElement_text();
});