diff --git a/public_html/css/default/LSform.css b/public_html/css/default/LSform.css index 796ce9e4..cbe4c8e9 100644 --- a/public_html/css/default/LSform.css +++ b/public_html/css/default/LSform.css @@ -138,3 +138,12 @@ dt.LSform-errors { img.LSform-add-field-btn, img.LSform-remove-field-btn { cursor: pointer; } + +/* -- LSformWarnBox -- */ +div.LSformWarnBox { + top: 100px!important; + left: 25%!important; + background-color: #f59a67!important; + border: 1px solid #f00!important; + color: #fff!important; +} diff --git a/public_html/includes/class/class.LSform.php b/public_html/includes/class/class.LSform.php index 3c7ae217..85739639 100644 --- a/public_html/includes/class/class.LSform.php +++ b/public_html/includes/class/class.LSform.php @@ -45,6 +45,8 @@ class LSform { var $maxFileSize = NULL; + var $warnings = array(); + /** * Constructeur * @@ -135,6 +137,10 @@ class LSform { 'ajaxSubmit' => ((isset($this -> config['LSform']['ajaxSubmit']))?$this -> config['LSform']['ajaxSubmit']:1) ); + if (!empty($this -> warnings)) { + $JSconfig['warnings']=$this -> warnings; + } + LSsession :: addJSconfigParam('LSform_'.$this -> idForm,$JSconfig); if($this -> can_validate) { @@ -549,6 +555,16 @@ class LSform { $this -> maxFileSize = $size; } + /** + * Ajoute un avertissement au sujet du formulaire + * + * @param[in] $txt string Le texte de l'avertissement + * + * @retval void + **/ + function addWarning($txt) { + $this -> warnings[]=$txt; + } /** * Méthode Ajax permetant de retourner le code HTML d'un élément du formulaire vide diff --git a/public_html/includes/js/LSform.js b/public_html/includes/js/LSform.js index a6e18a83..6f48f3ce 100644 --- a/public_html/includes/js/LSform.js +++ b/public_html/includes/js/LSform.js @@ -27,6 +27,21 @@ var LSform = new Class({ this.params={}; } this._ajaxSubmit=this.params.ajaxSubmit; + if ($type(this.params.warnings)) { + this.warnBox = new LSinfosBox({ + name: 'LSformWarnBox', + fxDuration: 600, + closeBtn: 1, + autoClose: 0 + }); + + this.warnTxt = '