Jquery Form Validation Checkboxes
Hi, My first post and new with jquery. I'm trying to implement the validation plugin. I've managed to make the code working in a separate file but once I implement it to my main file it just doesn't work.
This is how i generate my checkbox.
- <form id="formID" action="go.php" method="post" >
-
- <?php $result = mysql_query("SELECT * FROM tbl_category order by name ");
- $i=1;
- while($row = mysql_fetch_array($result)){
- echo '<input type="checkbox" class="validate[minCheckbox[1]] checkbox" name="categories[]" value="'.$row['category_id'].'" id="'.$row['name'].'">'.
- '<label for="'.$row['name'].'" class="fil_lab" ><span></span>'.$row['name']. '</label>';
- if($i%5==0)
- {
- $i = 0;
- echo '<br><br>';
- }
- $i++;}
- ?>
-
- <input class="submit" type="submit" value="Validate & Send the form!"/>
- </form>
and this is my links:
- <script src="js/jquery.js" type="text/javascript"></script>
- <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
- <script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
- <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
-
- <script>
- jQuery(document).ready(function(){
- // binds form submission and fields to the validation engine
- jQuery("#formID").validationEngine();
- });
- </script>
The above code is working but once I implemented it on my main file nothing happens. and my form just submits.
This is my head area:
-
- <script type='text/javascript'>
- var map;
- var marker;
-
-
- function initialize() {
- var negros = new google.maps.LatLng(10.4167, 123.0000);
- var mapOptions = {
- zoom: 8,
- center: negros,
- mapTypeId: 'roadmap'
- };
- map = new google.maps.Map(document.getElementById("map"), mapOptions);
-
-
- google.maps.event.addListener(map,'click', function(event) {
- document.getElementById("latbox").value = event.latLng.lat();
- document.getElementById("lngbox").value = event.latLng.lng();
- addMarker(event.latLng);
- });
-
- }
-
- function addMarker(location) {
- // ... snip ...
- if (!marker) {
- // Create the marker if it doesn't exist
- marker = new google.maps.Marker({
- position: location,
- map: map,
- draggable:true,
- animation: google.maps.Animation.DROP
- });
- }
- // Otherwise, simply update its location on the map.
- else { marker.setOptions({ position : location,
- animation : google.maps.Animation.BOUNCE}); }
- }
-
- </script>
- <!-- form validation-->
- <script src="js/jquery.js" type="text/javascript"></script>
- <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
- <script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8 </script>
- <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
-
- <script>
- jQuery(document).ready(function(){
- // binds form submission and fields to the validation engine
- jQuery("#formID").validationEngine();
- });
- </script>
- <!--END -->
-
- <style type="text/css">
- input[type="checkbox"] {
- display:none;
- }
- input[type="checkbox"] + label span {
- display:inline-block;
- width:19px;
- height:19px;
- margin:-1px 4px 0 0;
- vertical-align:middle;
- background:url(check_radio_sheet.png) left top no-repeat;
- cursor:pointer;
- }
- input[type="checkbox"]:checked + label span {
- background:url(check_radio_sheet.png) -19px top no-repeat;
- }
- </style>
-
- </head>
and how I generate checkboxes.
- <?php $result = mysql_query("SELECT * FROM tbl_category order by name ");
- $i=1;
- while($row = mysql_fetch_array($result)){
- echo '<input type="checkbox" class="validate[minCheckbox[1]] checkbox" name="categories[]"
- value="'.$row['category_id'].'" id="'.$row['name'].'">
- '.'<label for="'.$row['name'].'" class="fil_lab" ><span></span>'.$row['name'].'</label>';
- if($i%5==0)
- {
- $i = 0;
- echo '<br><br>';
- }
- $i++;}
- ?>
Please help. I've been trying to solve this the whole day.