This is my first use of jqform to load a mysql database.
All fields of the form are not saved
Only the fields ‘heuredebut’, ‘heurefin’, ‘fournisseur’ and ‘motif’ are saved.
The other fields have the default value
Do you have an idea ?
1 2 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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
?php //ini_set("display_errors",1); require_once './lib/test_session.php'; // include './lib/tab_array.php'; include './lib/init_cookies.php'; // $maj_libelle_0='Compléter la '.$tab_formulaire[$formulaire][1].' ('.$tab_formulaire[$formulaire][0].') pour l\'association '.$tab_association[$association]; $maj_libelle_1='Mettre à jour la '.$tab_formulaire[$formulaire][1].' ('.$tab_formulaire[$formulaire][0].') pour l\'association '.$tab_association[$association]; // include './lib/include_lib_form.php'; // Create instance $form_formulaire = new jqForm('form_formulaire', array('action'=>'', 'enctype'=>'multipart/form-data', 'method'=>'post', 'target'=>'_self', 'id'=>'form_formulaire')); // Set url $form_formulaire->setUrl($SERVER_HOST.$SELF_PATH.'g1'); $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); $conn->query("SET NAMES utf8"); $form_formulaire->setConnection( $conn ); // Set Form header $formhead=$maj_libelle_0; $form_formulaire->setFormHeader($formhead,'ui-icon-mail-open '); // Set parameters $jqformparams = array(); // $form_formulaire->table = 'demandes'; $form_formulaire->setPrimaryKeys('clef_1'); $form_formulaire->serialKey = true; // Set Form layout $form_formulaire->setColumnLayout('onecolumn'); // Set the style for the table $form_formulaire->setTableStyles('width:'.$width_table.'px; padding:0px 0px 20px 0px;'); // Add elements $elem_1[]=$form_formulaire->createElement('clef_1','hidden', array('label'=>'clef_1', 'id'=>'clef_1')); $elem_1[]=$form_formulaire->createElement('formulaire','hidden', array('label'=>'form_1', 'id'=>'form_1', 'value'=>$code)); $elem_1[]=$form_formulaire->createElement('association','hidden', array('label'=>'asso_1', 'id'=>'asso_1', 'value'=>$association)); $elem_1[]=$form_formulaire->createElement('statut','hidden', array('label'=>'sta_1', 'id'=>'sta_1', 'value'=>0)); $elem_1[]=$form_formulaire->createElement('lab_1','text', array('id'=>'lab_1', 'style'=>'background:#E1E1E1; text-align:center; width:70px;'.$margin_0, 'value'=>'Responsable', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('responsable','text', array('id'=>'responsable', 'style'=>'width:228px; '.$margin_1, 'value'=>$prenom.' '.$nom)); $elem_1[]=$form_formulaire->createElement('lab_2','text', array('id'=>'lab_2', 'style'=>'background:#E1E1E1; text-align:center; width:40px; '.$margin_1, 'value'=>'Courriel', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('courriel','text', array('id'=>'courriel', 'style'=>'width:257px; '.$margin_1, 'value'=>$courriel)); $elem_1[]=$form_formulaire->createElement('lab_3','text', array('id'=>'lab_3', 'style'=>'background:#E1E1E1; text-align:center; width:50px; '.$margin_1, 'value'=>'Téléphone', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('telephone','text', array('id'=>'telephone', 'style'=>'text-align:center; width:90px; '.$margin_1, 'value'=>$telephone)); $elem_1[]=$form_formulaire->createElement('lab_4','text', array('id'=>'lab_4', 'style'=>'background:#E1E1E1; text-align:center; width:70px; '.$margin_1, 'value'=>'Manifestation', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('manifestation','text', array('id'=>'manifestation', 'style'=>'width:758px; '.$margin_1, 'value'=>'')); $elem_1[]=$form_formulaire->createElement('lab_5','text', array('style'=>'background:#E1E1E1; text-align:center; width:55px; '.$margin_1, 'value'=>'Date Début', 'id'=>'lab_5', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('datedeb','text', array('id'=>'date_deb', 'style'=>'width:60px; text-align:center; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('lab_6','text', array('style'=>'background:#E1E1E1; text-align:center; width:60px; '.$margin_1, 'value'=>'Heure Début', 'id'=>'lab_6', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('heuredeb','select', array('id'=>'heure_deb', 'datalist'=>$tab_heure, 'style'=>'text-align:center; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('lab_7','text', array('style'=>'background:#E1E1E1; text-align:center; width:43px; '.$margin_1, 'value'=>'Date Fin', 'id'=>'lab_7', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('datefin','text', array('id'=>'date_fin', 'style'=>'width:60px; text-align:center; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('lab_8','text', array('style'=>'background:#E1E1E1; text-align:center; width:45px; '.$margin_1, 'value'=>'Heure Fin', 'id'=>'lab_8', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('heurefin','select', array('id'=>'heure_fin', 'datalist'=>$tab_heure, 'style'=>'text-align:center; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('lab_9','text', array('style'=>'background:#E1E1E1; text-align:center; width:50px; '.$margin_1, 'value'=>'Licenciés', 'id'=>'lab_9', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('lab_10','text', array('style'=>'background:#E1E1E1; text-align:center; width:40px; '.$margin_1, 'value'=>'Seniors', 'id'=>'lab_10', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('lic_sen','text', array('id'=>'lic_sen', 'style'=>'text-align:center; width:20px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('lab_11','text', array('style'=>'background:#E1E1E1; text-align:center; width:40px; '.$margin_1, 'value'=>'Jeunes', 'id'=>'lab_11', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('lic_jeu','text', array('id'=>'lic_jeu', 'style'=>'text-align:center; width:20px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('lab_12','text', array('style'=>'background:#E1E1E1; text-align:center; width:850px; '.$margin_1, 'value'=>'Motif de la Demande', 'id'=>'lab_12', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('motif','textarea', array('rows' => '2', 'style'=>'width:850px; '.$margin_1, 'id'=>'motif')); $elem_1[]=$form_formulaire->createElement('lab_13','text', array('style'=>'background:#E1E1E1; text-align:center; width:850px; '.$margin_1, 'value'=>'Coordonnées complètes des Fournisseurs (par ordre de préférence)', 'id'=>'lab_13', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('fournisseur','textarea', array('rows' => '2', 'style'=>'width:850px; '.$margin_1, 'id'=>'fournisseur')); $elem_1[]=$form_formulaire->createElement('lab_14','text', array('style'=>'background:#E1E1E1; text-align:center; width:663px; '.$margin_1, 'value'=>'Référence exacte des Fournitures (par ordre de préférence)', 'id'=>'lab_14', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('lab_15','text', array('style'=>'background:#E1E1E1; text-align:center; width:50px; '.$margin_1, 'value'=>'Quantité', 'id'=>'lab_15', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('lab_16','text', array('style'=>'background:#E1E1E1; text-align:center; width:90px; '.$margin_1, 'value'=>'Prix Unitaire T.T.C.', 'id'=>'lab_16', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('reference1','text', array('id'=>'reference1', 'style'=>'text-align:left; width:662px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('quantite1','text', array('id'=>'quantite1', 'style'=>'text-align:center; width:50px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('prix1','text', array('id'=>'prix1', 'style'=>'text-align:center; width:90px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('reference2','text', array('id'=>'reference2', 'style'=>'text-align:left; width:662px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('quantite2','text', array('id'=>'quantite2', 'style'=>'text-align:center; width:50px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('prix2','text', array('id'=>'prix2', 'style'=>'text-align:center; width:90px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('reference3','text', array('id'=>'reference3', 'style'=>'text-align:left; width:662px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('quantite3','text', array('id'=>'quantite3', 'style'=>'text-align:center; width:50px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('prix3','text', array('id'=>'prix3', 'style'=>'text-align:center; width:90px; '.$margin_1)); $elem_1[]=$form_formulaire->createElement('lab_17','text', array('style'=>'background:#E1E1E1; text-align:center; width:200px; '.$margin_1, 'value'=>'Joindre un ou plusieurs documents', 'id'=>'lab_17', 'contenteditable'=>'false')); $elem_1[]=$form_formulaire->createElement('fichier_con','file', array('id'=>'fichier_con', 'size'=>'40', 'name'=>'fichier_con', 'multiple'=>'multiple', 'class'=>'om-deux')); $form_formulaire->addGroup('choix_un',$elem_1, array('class'=>'om-un', 'id'=>'formulaire_Group_1')); $elem_2[]=$form_formulaire->createElement('creerformulaire','submit', array('value'=>'Envoyer', 'contenteditable'=>'false', 'id'=>'creerformulaire', 'style'=>'padding:5px; margin:2px 0px 2px 0px;')); $form_formulaire->addGroup('choix_quatre',$elem_2, array('class'=>'om-un', 'id'=>'formulaire_Group_2')); // automatic file upload options $form_formulaire->setUploadOptions('fichier_con', array( 'dir'=>'./', // directory to upload 'filetypes'=>'', // allowed file types. if empty all 'filesize'=>4194304, // bytes 1024*1024 = 4Mb 'fileprefix'=>'' // add a prefix to the file name )); // Add events $onclickcreerformulaire = <<< CLICKCREERFORMULAIRE function(event) { document.forms['form_formulaire'].action='./m1c-ok'; document.forms['form_formulaire'].method="POST"; document.forms['form_formulaire'].target="_self"; document.forms['form_formulaire'].enctype="multipart/form-data"; document.forms['form_formulaire'].submit(); return; } CLICKCREERFORMULAIRE; $onfocus_lab_1 = <<< CLICKFOCUSLAB1 function(event) { $('#manifestation').focus(); } CLICKFOCUSLAB1; $onfocus_cha_1 = <<< CLICKFOCUSCHA1 function(event) { $('#manifestation').focus(); } CLICKFOCUSCHA1; $onfocus_lab_2 = <<< CLICKFOCUSLAB2 function(event) { $('#manifestation').focus(); } CLICKFOCUSLAB2; $onfocus_cha_2 = <<< CLICKFOCUSCHA2 function(event) { $('#manifestation').focus(); } CLICKFOCUSCHA2; $onfocus_lab_3 = <<< CLICKFOCUSLAB3 function(event) { $('#manifestation').focus(); } CLICKFOCUSLAB3; $onfocus_cha_3 = <<< CLICKFOCUSCHA3 function(event) { $('#manifestation').focus(); } CLICKFOCUSCHA3; $onfocus_lab_4 = <<< CLICKFOCUSLAB4 function(event) { $('#manifestation').focus(); } CLICKFOCUSLAB4; $onfocus_cha_4 = <<< CLICKFOCUSCHA4 function(event) { $('#manifestation').focus(); } CLICKFOCUSCHA4; $onfocus_lab_5 = <<< CLICKFOCUSLAB5 function(event) { $('#date_deb').focus(); } CLICKFOCUSLAB5; $onfocus_lab_6 = <<< CLICKFOCUSLAB6 function(event) { $('#heure_deb').focus(); } CLICKFOCUSLAB6; $onfocus_lab_7 = <<< CLICKFOCUSLAB7 function(event) { $('#date_fin').focus(); } CLICKFOCUSLAB7; $onfocus_lab_8 = <<< CLICKFOCUSLAB8 function(event) { $('#heure_fin').focus(); } CLICKFOCUSLAB8; $onfocus_lab_9 = <<< CLICKFOCUSLAB9 function(event) { $('#lic_sen').focus(); } CLICKFOCUSLAB9; $onfocus_lab_10 = <<< CLICKFOCUSLAB10 function(event) { $('#lic_sen').focus(); } CLICKFOCUSLAB10; $onfocus_lab_11 = <<< CLICKFOCUSLAB11 function(event) { $('#lic_jeu').focus(); } CLICKFOCUSLAB11; $onfocus_lab_12 = <<< CLICKFOCUSLAB12 function(event) { $('#motif').focus(); } CLICKFOCUSLAB12; $onfocus_lab_13 = <<< CLICKFOCUSLAB13 function(event) { $('#fournisseur').focus(); } CLICKFOCUSLAB13; $onfocus_lab_14 = <<< CLICKFOCUSLAB14 function(event) { $('#reference1').focus(); } CLICKFOCUSLAB14; $onfocus_lab_15 = <<< CLICKFOCUSLAB15 function(event) { $('#quantite1').focus(); } CLICKFOCUSLAB15; $onfocus_lab_16 = <<< CLICKFOCUSLAB16 function(event) { $('#prix1').focus(); } CLICKFOCUSLAB16; $onfocus_lab_17 = <<< CLICKFOCUSLAB17 function(event) { $('#fichier_con').focus(); } CLICKFOCUSLAB17; // $onchangegroupe = <<< CHANGEGROUPE function(event) { } CHANGEGROUPE; // Add javascript code $javascriptform_formulaire = <<< JSFORMULAIRE $("#date_deb").datepicker({dateFormat:'dd/mm/yy'}); $("#date_fin").datepicker({dateFormat:'dd/mm/yy'}); JSFORMULAIRE; // $form_formulaire->setJSCode($javascriptform_formulaire); $form_formulaire->addEvent('creerformulaire','click',$onclickcreerformulaire); $form_formulaire->addEvent('lab_1','focus',$onfocus_lab_1); $form_formulaire->addEvent('lab_2','focus',$onfocus_lab_2); $form_formulaire->addEvent('lab_3','focus',$onfocus_lab_3); $form_formulaire->addEvent('lab_4','focus',$onfocus_lab_4); $form_formulaire->addEvent('lab_5','focus',$onfocus_lab_5); $form_formulaire->addEvent('lab_6','focus',$onfocus_lab_6); $form_formulaire->addEvent('lab_7','focus',$onfocus_lab_7); $form_formulaire->addEvent('lab_8','focus',$onfocus_lab_8); $form_formulaire->addEvent('lab_9','focus',$onfocus_lab_9); $form_formulaire->addEvent('lab_10','focus',$onfocus_lab_10); $form_formulaire->addEvent('lab_11','focus',$onfocus_lab_11); $form_formulaire->addEvent('lab_12','focus',$onfocus_lab_12); $form_formulaire->addEvent('lab_13','focus',$onfocus_lab_13); $form_formulaire->addEvent('lab_14','focus',$onfocus_lab_14); $form_formulaire->addEvent('lab_15','focus',$onfocus_lab_15); $form_formulaire->addEvent('lab_16','focus',$onfocus_lab_16); $form_formulaire->addEvent('lab_17','focus',$onfocus_lab_17); $form_formulaire->addEvent('responsable','focus',$onfocus_cha_1); $form_formulaire->addEvent('courriel','focus',$onfocus_cha_2); $form_formulaire->addEvent('telephone','focus',$onfocus_cha_3); // $form_formulaire->setAjaxOptions( array('dataType'=>null, 'resetForm' =>null, 'clearForm' => null, 'iframe' => true, 'forceSync' =>false) ); // Render the form echo $form_formulaire->renderForm($jqformparams); |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top