My Php form (organisation.php) has this javascript validation
if(document.orgform.startdate.value == '')
{
alert('Enter Start Date');
document.orgform.startdate.focus();
return false;
}
if(document.orgform.enddate.value == '')
{
alert('Enter End Date');
document.orgform.enddate.focus();
return false;
} //these work fine
JQUERY
function getorgname(key)
{
var orgvalue = key.value;
$.ajax({
type:"POST",
url:"searchorg.php",
data:{orgname : orgvalue},
success: function(res) {
$('#org').html(res);
}
});
} //returns organisation names with checkboxes, working fine
HTML Part of organisation part is as follows:
<input type="text" name="startdate" id="sdate" >
<input type="text" name="enddate" id="edate">
<div id="organisation></div> //ajax returned values displayed here, working fine.
Now how do I test if at least one checkbox is checked?
I tried putting validation in ajaxorganisation.php as well as orgnaisation.php and called that function while submitting organisation.php, but it does not work.
Server side validation is working fine, but would appreciate if there is a way for client side validation too