typeerror:cannot set property 'onsubmit' of null
//validation of registration page.. function validate_form_registration() { document.getElementById('form_reg').onsubmit=function() { if (document.getElementById('first_name').value.length=="") { document.getElementById('error').innerHTML="please enter first name"; document.getElementById('first_name').focus(); return false; } else if (document.getElementById('last_name').value.length=="") { document.getElementById('error').innerHTML="please enter Last name"; document.getElementById('last_name').focus(); return false; } else if (document.getElementById('username').value.length=="") { document.getElementById('error').innerHTML="please enter Username"; document.getElementById('username').focus(); return false; } else if (document.getElementById('mail').value.length=="") { document.getElementById('error').innerHTML="please enter Email"; document.getElementById('mail').focus(); return false; } else if (document.getElementById('dept').value.length=="") { document.getElementById('error').innerHTML="please enter your Department"; document.getElementById('dept').focus(); return false; } else if (document.getElementById('id_number').value.length=="") { document.getElementById('error').innerHTML="please enter ID number"; document.getElementById('id_number').focus(); return false; } else if (document.getElementById('phone').value.length=="") { document.getElementById('error').innerHTML="please enter Phone number"; document.getElementById('phone').focus(); return false; } else if (document.getElementById('address').value.length=="") { document.getElementById('error').innerHTML="please enter Your Adress"; document.getElementById('address').focus(); return false; } else { document.getElementById('error').innerHTML=""; return true; } }; }; //end of registration page... //validation of login page..... function validate_form_login() { document.getElementById('form_log').onsubmit=function() { if(document.getElementById('username').value.length=='') { document.getElementById('error').innerHTML='Please enter username'; document.getElementById('username').focus(); return false; } else if(document.getElementById('password').value.length=='') { document.getElementById('error').innerHTML='Please enter password'; document.getElementById('password').focus(); return false; } else { document.getElementById('error').innerHTML=''; return true; } }; }; //validation of application page.. function validate_form_aplic() { document.getElementById('form_anous').onsubmit=function(){ if(document.getElementById('select_item').value.length=='') { document.getElementById('error').innerHTML='Please select leave type'; document.getElementById('select_item').focus(); return false; } else if(document.getElementById('txtarea').value.length=='') { document.getElementById('error').innerHTML='Please enter application'; document.getElementById('txtarea').focus(); return false; } else if(document.getElementById('fromt').value.length=='') { document.getElementById('error').innerHTML='Please enter time'; document.getElementById('fromt').focus(); return false; } else if(document.getElementById('tot').value.length=='') { document.getElementById('error').innerHTML='Please enter time limit'; document.getElementById('tot').focus(); return false; } else { document.getElementById('error').innerHTML=''; return true; } }; }; window.onload=function() { try { validate_form_aplic(); validate_form_login(); validate_form_registration(); } catch (error) { alert(error); } };
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)