Here is the code for checkbox validation
I think there is a problem with 'return' statements.
As validation for textbox works fine but for checkbox it won't.
After clicking all checkboxes it shows alert message alert(Select user)....Please help me...
Thank you
function Vailidate(form)
{
'validate textbox
var total = 0;
if (form.taskdescr.value == '')
{
alert('Task Description is required.');
return (false);
}
'validate chkbox
var node_list = document.getElementsByTagName('input');
var chkboxes = [];
for (var i = 0; i < node_list.length; i++)
{
var node = node_list[i];
if (node.getAttribute('type') == 'checkbox')
{
chkboxes.push(node);
}
}
if (!chkboxes.checked)
{
alert('select user');
return false;
}
else
{
alert('selected');
}
}

New Topic/Question
Reply



MultiQuote





|