phpJSvForm
v11.11.12
Des classes PHP, des JavaScripts pour créer facilement un formulaire.
|
00001 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 00002 <html xmlns="http://www.w3.org/1999/xhtml"> 00003 <head> 00004 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 00005 <title>Test Formulaire - Champs autorisés/obligatoires si condition</title> 00006 <script type="text/javascript" src="form/init.js"></script> 00007 <script type="text/javascript" src="form/jsVerifForm.js"></script> 00008 <link rel="stylesheet" type="text/css" href="form/cssVerifForm.css" /> 00009 </head> 00010 <body> 00011 <?php 00024 require_once('../form/clVerifForm.php'); 00025 00026 $form1 = new Form(); 00027 $p1 = new Paragraphe('','Un formulaire avec des champs autorisés si ...', 'cssform3') ; 00028 $p2 = new Paragraphe('','','cssSansBordure') ; 00029 $p3 = new Paragraphe('','','cssform3') ; 00030 $chk1 = new Input('chk_adr','Je communique mon adresse postale','','checkbox') ; 00031 $text1 = new Input('adr','Adresse : ',''); 00032 $text2 = new Input('cp','Code postal : ',''); 00033 $text3 = new Input('ville','Ville : ',''); 00034 $chk2 = new Input('chk_tel','Je communique mon numéro de téléphone','','checkbox') ; 00035 $tel = new Input('tel','Téléphone','','','','cssform2'); 00037 $p1->addElement($chk1) ; 00038 $p2->addElement($text1, $text2 ,$text3); 00039 $form1->addElement($p1, $p2, $p3->addElement($chk2, $tel)) ; 00040 00041 $form1->addVerif('exist_A',$chk1,$text1, $text2 ,$text3) ; 00042 $form1->addVerif('exist_B',$chk2,$tel) ; 00043 $form1->addVerif('tel',$tel,'codePostal',$text2) ; 00044 00045 if($form1->verifForm()) 00046 { 00047 echo '<p>Traitement possible... Tout est ok...</p>' ; 00048 echo '<pre>' ; 00049 print_r($_POST) ; 00050 echo '</pre>' ; 00051 } 00052 else 00053 echo $form1; 00054 ?> 00055 </body> 00056 </html>