How would i Valiadate Datepicker is empty
My date picker is joined into my Contact form on pressing the Submit button all fields on the form are validated ok.
how would i validate,,,,, that a date as been selected and not submitted with an empty field. below is my code
<!-- Start of datepicker -->
<script>
$(document).ready(function()
{
$("#datepicker").datepicker();
});
</script>
<!-- $(selector).datepick({dateFormat: 'yyyy-mm-dd'}); for my example -->
<script>
$(function() {
$.datepicker.setDefaults({dateFormat: 'DD, d MM yy', autoSize: true,
minDate: -0, maxDate: '+1M +05D', showOn: 'button',
buttonImage: '/contact/images/calendar.gif', buttonImageOnly: true, });
$('input[name="Your Check In Date Is"],input[name="Your Check Out Date Is"]').datepicker();
});
</script>
<script type="text/javascript">
$(function(){
$("input[name='Your Check In Date Is']").datepicker();
$("input[name='Your Check Out Date Is']").datepicker();
});
</script>
<label for="datepicker">Select Your Check In Date</label>
<form method="post" id="myForm">
<input name="Your Check In Date Is" maxlength="30" class="text ui-widget-content ui-corner-all" />
<label for="datepicker">Select Your Check Out Date</label>
<input name="Your Check Out Date Is" maxlength="30" class="text ui-widget-content ui-corner-all" />
<!-- End of datepicker -->
<!-- Start of submit -->
<div class="submit">
<input type="submit" id="submit" name="submit" value="Click To Comfirm Your Booking Details" />
</div> <!-- end .submit -->
<!-- End of Submit -->
</form>
<div id="footer">
<p>© <?php echo date('Y'); ?>Copyright Webber's InterConinental Tours... All rights reserved.</p>
</div><!-- end footer -->
<?php else: ?>
<p style="font-size:35px; font-family:Arial, Helvetica, sans-serif; color:#255E67; margin-left:25px;">You are now being redirected to the secure payment site</p>
<script type="text/javascript">
setTimeout('ourRedirect()', 5000)
function ourRedirect(){
location.href='http://philippines4u.co.uk/PayPal Manila Condo form.html'
}
</script>
<?php endif; ?>
</div> <!--end #form -->
</div> <!-- end formWrap -->
</body>
</html>
Have been working with this code if($("#fieldID").val() == "") { alert("no date selected"); } But i Cant make it work.