La Ferme du web - Les forums

Venez baraguiner avec la communauté !

Vous n'êtes pas identifié.

#1 24/03/2015 17:09:50

manelll
Membre
Date d'inscription: 24/03/2015
Messages: 2

champs obligatoire du formulaire avec jQuery

Bonjour , je viens de réaliser un formulaire et je veux que certain champs soit obligatoire pour cela j'ai utilisé  le plugin jQuery.validity mais ça n'a pas marché c'est à dire même si je ne remplit pas les champs obligatoire le formulaire est envoyé et ce n'est ce que je voudrais réalisé hmm   j'ai besoin d'aide pour résoudre mon problème ci-dessous le code source du formulaire s'il ya quelques choses qui n'est pas claire veuillez me le dire s'il vous plait





Code:

<?php
require('config.php');
mysql_query("SET NAMES utf8");
mysql_query("set characer set utf8");
?>
<!doctype html>
<html><head>
    <meta charset="utf-8">
    <title>تسجيل معطيات الأفراد</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/css/main.css" rel="stylesheet">
    <link href="assets/css/font-style.css" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/register.css">



    <style type="text/css">
      body {
        padding-top: 60px;
      }
    </style>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">

      <!-- Google Fonts call. Font Used Open Sans & Raleway -->
    <link href="assets/css/css.css" rel="stylesheet" type="text/css">

    <script type="text/javascript" src="assets/js/jquery.js"></script>
<script type="text/javascript" src="assets/js/jquery.validate.js"></script>



    </head>
  <body style=" background-color: #1f1f1f; ">

      <!-- NAVIGATION MENU -->

   <div class="navbar-nav navbar-inverse navbar-fixed-top">
        <div class="container">
   
          <div class="navbar-collapse collapse">
            <ul id="menu-deroulant" class="nav navbar-nav" style="margin-left: 400px;">
              
            <!--  <li><a href="manager.html"><i class="icon-folder-open icon-white"></i> File Manager</a></li>-->
              <li><a href="persoExemp.html"><i class="icon-calendar icon-white"></i> قائمة الأفراد المعفيين</a></li>
              <li><a href="menuDisponibilite.html"><i class="icon-calendar icon-white"></i> قائمة توفر الأفراد</a></li>
             
       <li><a href="menu_exemption.html"> الإعفاءت</a></li>
            
                
                
                
         <li class="active"><a href="#"><i class="icon-user icon-white"></i> الأفراد</a>
              
        <ul>
            <li><a href="user.php">إضافة فرد</a></li>
            <li><a href="del_perso.html">حذف فرد</a></li>
            <li><a href="menu_modif_user.html">تحيين فرد</a></li>
            <li><a href="liste.html">قائمة الأفراد</a></li>
        </ul>
              </li>
             
<li ><a href="index.html"><i class="icon-home icon-white"></i> الاستقبال</a></li>
            </ul>
          </div><!--/.nav-collapse -->
        </div>
    </div>

    <div class="container">
     

            <div class="col-sm-6 col-lg-6">
                <div id="register-wraper">
                    <form  id="register-form" method="POST" class="form" action="add.php">
                        <legend>معطيات الأفراد</legend>
                    
                        <div class="body">
        
                            <label for="name">الإسم *</label>
                            <input dir='rtl' id='name' name='name' class="input-huge" type="text" >
                  
                            <label for="surname">اللقب *</label>
                            <input dir='rtl' id='surname' name='surname' class="input-huge" type="text" >
            
                            <label>الرتبة</label>
                        <div id='grade_select'>
                            
                                <?php
                                        echo '<select  size=1 name="grade" id="grade">'."\n";
                                        echo '<option value="-1">--قائمة الرتب--</option>'."\n";
                                        $result = mysql_query("SELECT grade FROM grade" );
                                        while($data =  mysql_fetch_array($result))
                                            {
                                                echo '<option value="'.$data[0].'">'.$data['grade'];
                                                echo '</option>'."\n";
                                            }
                                                echo '</select>'."\n";
                                            
                                ?>    
                            
                            </div>
                            <label >رقم بالقطعة</label>
                            <input dir='rtl' id='matricule' name='matricule' class="input-huge" type="text">
                  
                                 <label>    الوحدة *</label>
                            <input name='unite' id='unite' dir='rtl'class="input-huge" type="text">
                        
                            <label>الرقم بالوحدة</label>
                            <input  name='num_unite' id='num_unite' dir='rtl'class="input-huge" type="text" >
       
                                <label>الرقم بالتجنيد</label>
                            <input name='num_tajnid' id='num_tajnid' dir='rtl'class="input-huge" type="text">
                            
                                    <label>    رقم السلاح</label>
                            <input name='num_arme'  id='num_arme' dir='rtl'class="input-huge" type="text">
                                    <label>        رقم الحربة</label>
                            <input name='num_dague' id='num_dague' dir='rtl'class="input-huge" type="text">
                        
                               <label>صنف الدم *</label>
                            <input name='type_sang'  id='type_sang' dir='rtl'class="input-huge" type="text" >
                                <label>العنوان</label>
                            <input name='addresse'  id='addresse'  dir='rtl'class="input-huge" type="text">
                            <label>رقم الهاتف</label>
                            <input name='telephone'  id='telephone' dir='rtl'class="input-huge" type="text">
                            
                            <label>نوع الاعفاء</label>
                        <div id='exemp_select'>
                            
                                <?php
                                        echo '<select  size=1 name="exemption" id="exemption">'."\n";
                                        echo '<option value="-1">--قائمة الاعفاءات--</option>'."\n";
                                        $result = mysql_query("SELECT nom_exemption FROM exemption" );
                                        while($data =  mysql_fetch_array($result))
                                            {
                                                echo '<option value="'.$data[0].'">'.$data['nom_exemption'];
                                                echo '</option>'."\n";
                                            }
                                                echo '</select>'."\n";
                                            
                                ?>    
                            
                            </div>
                        
                        <label>حالة التوفر</label>
                        <div id='dispo_select'>
                            
                                <?php
                                        echo '<select  size=1 name="disponibilité" id="disponibilité">'."\n";
                                        echo '<option value="-1">--حالات التوفر الممكنة--</option>'."\n";
                                        $result = mysql_query("SELECT Etat_dispo FROM disponibilité" );
                                        while($data =  mysql_fetch_array($result))
                                            {
                                                echo '<option value="'.$data[0].'">'.$data['Etat_dispo'];
                                                echo '</option>'."\n";
                                            }
                                                echo '</select>'."\n";
                                            
                                ?>    
                            
                            </div>
                    
                         </div>
 

 
                        <div class="footer">
                              <button type="submit" class="btn btn-success">تسجيل البيانات</button>
                        </div>
                    </form>
                    
                </div>
            </div>

        </div>
    </div>
<!--création de champs obligatoire-->
    <script type="text/javascript" language="javascript">
$(window).load(function() {
    $("#register-form").validate(function() {
        $("#name").require("الرجاء ادخال اسم الفرد");
    });
});
</script>
    <div id="footerwrap">
          <footer class="clearfix"></footer>
          <div class="container">
              <div class="row">
                  <div class="col-sm-12 col-lg-12">
                  <p><img src="assets/img/logo.png" alt=""></p>
                  <p>L.R. Mohamed Fadhel Benzarti</p>
                  </div>

              </div><!-- /row -->
          </div><!-- /container -->        
    </div><!-- /footerwrap -->


    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="assets/js/bootstrap.js"></script>

  
</body></html>

Dernière modification par manelll (24/03/2015 20:38:11)

Hors ligne

 

24/03/2015 17:09:50

Botte De Foin Publicitaire


Pied de page des forums

Powered by FluxBB
© Copyright 2008-2009 - LaFermeduWeb.net