# Validation of a HTML form

**URL:** <https://forum.kirupa.com/t/validation-of-a-html-form/276370>\
**Category:** Uncategorized\
**Created:** [November 26, 2008, 9:34am UTC](https://forum.kirupa.com/t/validation-of-a-html-form/276370 "2008-11-26T09:34:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amanuel100](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@amanuel100](https://forum.kirupa.com/u/amanuel100)\
**Post date:** [November 26, 2008, 9:34am UTC](https://forum.kirupa.com/t/validation-of-a-html-form/276370/1 "2008-11-26T09:34:22Z")

</div>

hello,  
I have put this in my html form  
\</head\>  
\<script language=“javascript”\>  
function docElem(elem){  
return document.getElementById(elem);  
}

```
        function checkTerms(){             
          if (docElem("cbTerms").checked == false){
               docElem("termsMsg").innerHTML = "You have to agree with the terms and conditions";                  
          }else{
               docElem("termsMsg").innerHTML = "";
               docElem("frmTerms").submit();
          }
      }
    &lt;/script&gt;

```

\<title\>

\<form name=“postanadd” method=“post” action=“handle\_form.php” id=“frmTerms”\>\<div id=“termsMsg”\>\</div\>  
[COLOR=Red]  
Is this correct?  
and then.  
[COLOR=Black]  
\<input type=“checkbox” name=“cbTerms” id=“cbTerms” value=“off”\>

\<input type=“submit” onclick=“checkTerms();” name=“formSubmit” value=“Submit” id=“Submit2”\>  
[/COLOR][/COLOR]  
If the tems is not ticket i want to display a msg saying  
[COLOR=Red]“You have to agree with the terms and conditions”[/COLOR]  
within the form.

can someone please help.  
[balamberas@yahoo.com](mailto:balamberas@yahoo.com)
