| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 
 |  
   1.
      window.addEvent('domready', function() {
   2.
 
   3.
              var list = $$('.row_form');
   4.
 
   5.
              list.each(function(element){
   6.
                      var child_list = element.childNodes;
   7.
                      var little_child_list = child_list[0].childNodes;
   8.
                      var error_element = child_list[1];
   9.
                      var input_element = element.childNodes[0].childNodes[1];
  10.
 
  11.
                      var fx = new Fx.Styles(error_element, {
  12.
                                      duration : 1500,
  13.
                                      wait : false,
  14.
                                      transition: Fx.Transitions.Quad.easeOut
  15.
                              });
  16.
 
  17.
                      var fx2 = new Fx.Styles(input_element, {
  18.
                                      transition: Fx.Transitions.Quad.easeOut
  19.
                              });
  20.
 
  21.
                      input_element.addEvent('focus', function(){
  22.
                              fx.start({
  23.
                                      'background-color' : ['#ddeeff']
  24.
                              });
  25.
                      });
  26.
 
  27.
                      input_element.addEvent('blur', function(){
  28.
 
  29.
                              fx2.start({
  30.
                                              'background-color' : ['#fff']
  31.
                                      });
  32.
 
  33.
                              if(input_element.value == ''){
  34.
 
  35.
                                      input_element.setHTML('Ce champ est obligatoire !!!');
  36.
                                      fx.start({
  37.
                                                      'background-color': ['#ff0000', '#fff'],
  38.
                                                      'display': ['block', 'none']
  39.
                                              });
  40.
                              }
  41.
                              else{
  42.
                                      fx2.start({
  43.
                                              'background-color' : ['#fff']
  44.
                                      });
  45.
                              }
  46.
                      });
  47.
 
  48.
              });
  49.
 
  50.
 
  51.
      }); | 
Partager