diff --git a/order/select_driver.php b/order/select_driver.php index db891adb157f1f7b76bf4a408343747bf0027e11..85e7d94bda42336190e9333c0b5301cb2dc9d34f 100644 --- a/order/select_driver.php +++ b/order/select_driver.php @@ -154,7 +154,6 @@ <div id="driver_table_container"> <form method="post" id="submit_select_drv" action=<?php echo "complete_order.php?id=".$user_id ?>> - <?php echo $ppoint . $dest; ?> <div class="content" id="select_driver"> <div id="preferred_driver"> diff --git a/order/select_location.php b/order/select_location.php index ea9e4169e87fe31b2e337917a6fe914e1b493ac2..6514ad8c1074ce65ccf1328e7e4e8f9a7917da90 100644 --- a/order/select_location.php +++ b/order/select_location.php @@ -65,25 +65,43 @@ </div> - <form method="post" action=<?php echo "select_driver.php?id=" . $user_id;?>> + <form method="post" id="submit_select_loc" name="submit_select_loc" action=<?php echo "select_driver.php?id=" . $user_id;?> onsubmit="return checkValidity();"> <div class="content" id="select_destination"> <div> <span class="loc_form_label">Picking point</span> - <input type="text" name="picking_point"> + <input type="text" name="picking_point" id="picking_point"> </div> <div> <span class="loc_form_label">Destination</span> - <input type="text" name="destination"> + <input type="text" name="destination" id="destination"> </div> <div> <span class="loc_form_label">Preferred driver</span> <input type="text" name="preferred_driver"> </div> - <input type="submit" name="submit_select_loc" class="button green" id="loc_button" value="Next"> + <div class="button green" onclick="checkValidity();"> + Next + </div> </div> </form> </div> </div> </body> +<script type="text/javascript"> + window.alert('weo'); + + function checkValidity() { + var form = document.getElementById('submit_select_loc'); + var PPfield = document.getElementById('picking_point'); + var Dfield = document.getElementById('destination'); + var isValid = (PPfield.value == "" || Dfield.value == "") ? false : true; + + if (!isValid) { + window.alert("Please fill both picking point and destination fields"); + } else { + form.submit(); + } + } + </script> </html>