I am 95% there, but since I am not a Javascript or web developer by trade, I couldn't beat this into submission. Any help would be greatly appreciated.
I have this simple script that evaluates text input fields and a checkbox that someone must check before proceeding. "agreement" is the checkbox name/id. I have this working without any problems when I use text fields but when I introduce the checkbox it does not seem to work.
Any help is greatly appreciated! Thanks in advance.
Code:<form onsubmit="return checkForm(this)"> <input name="agreement" type="checkbox" id="agreement" value="1" /> ... </form> <script type="text/javascript"> function checkForm(frm){ msg = ""; if(!frm.first_name.value){ msg += "- First name is required\n"; } if(!frm.agreement.value){ msg += "- Accept the terms of use\n"; } if(msg != ""){ alert(msg); return false; } } </script>



Reply With Quote

Bookmarks