mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 08:19:05 +01:00
LSattr_html_select_list : simplify addToForm() method using parent method
This commit is contained in:
parent
316aee7f49
commit
110f162367
1 changed files with 8 additions and 13 deletions
|
@ -42,6 +42,8 @@
|
||||||
*/
|
*/
|
||||||
class LSattr_html_select_list extends LSattr_html{
|
class LSattr_html_select_list extends LSattr_html{
|
||||||
|
|
||||||
|
var $LSformElement_type = 'select';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ajoute l'attribut au formualaire passer en paramètre
|
* Ajoute l'attribut au formualaire passer en paramètre
|
||||||
*
|
*
|
||||||
|
@ -54,19 +56,12 @@ class LSattr_html_select_list extends LSattr_html{
|
||||||
function addToForm (&$form,$idForm,$data=NULL) {
|
function addToForm (&$form,$idForm,$data=NULL) {
|
||||||
$possible_values=$this -> getPossibleValues();
|
$possible_values=$this -> getPossibleValues();
|
||||||
$this -> config['text_possible_values'] = $possible_values;
|
$this -> config['text_possible_values'] = $possible_values;
|
||||||
$element=$form -> addElement('select', $this -> name, $this -> config['label'],$this -> config, $this);
|
$element=parent::addToForm($form,$idForm,$data);
|
||||||
if(!$element) {
|
|
||||||
LSerror :: addErrorCode('LSform_06',$this -> name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($data) {
|
|
||||||
$element -> setValue($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mise en place de la regle de verification des donnees
|
if ($element) {
|
||||||
$form -> addRule($this -> name, 'inarray', array('msg'=> 'Valeur incorrect','params' => array('possible_values' => array_keys($possible_values))) );
|
// Mise en place de la regle de verification des donnees
|
||||||
|
$form -> addRule($this -> name, 'inarray', array('msg'=> 'Valeur incorrect','params' => array('possible_values' => array_keys($possible_values))) );
|
||||||
// On retourne un pointeur vers l'element ajouter
|
}
|
||||||
return $element;
|
return $element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue