# Form validation problems

**URL:** <https://forum.kirupa.com/t/form-validation-problems/176157>\
**Category:** Uncategorized\
**Created:** [January 20, 2006, 7:57pm UTC](https://forum.kirupa.com/t/form-validation-problems/176157 "2006-01-20T19:57:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cxlink](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/cxlink/32/2077_2.png) [@cxlink](https://forum.kirupa.com/u/cxlink)\
**Post date:** [January 20, 2006, 7:57pm UTC](https://forum.kirupa.com/t/form-validation-problems/176157/1 "2006-01-20T19:57:08Z")

</div>

I am using the below script to validate a form. everything works except the email validation and the combo box “rso” (not highlighted). Any help is appreciated.

```auto
indexOfAt = email2.text.indexOf("@");
    lastIndexOfDot = email2.text.lastIndexOf(".");

errorcode = "";
    if (consent2 == false){
        errorcode += "You must indicate your agreement with the terms of this offer to continue
";}
    
    if (coname.text == null || coname.text == ""){
        errorcode += "You must enter your company name
";}

    if (email2.text == null || email2.text == ""){
        errorcode += "You must enter your email address
";}

    if (confirmEmail.text == null || confirmEmail.text == ""){
        errorcode += "Please enter your email address in both fields
";}
    
    if (email2.text != confirmEmail.text){
        errorcode += "The email addresses do not match
";}

```

```
if (indexOfAt !=-1 && lastIndexOfDot !=-1){
    if (lastIndexOfDot <indexOfAt) {
        errorcode += "Please verify your email

```

";}  
else {  
errorcode += "Please enter correct email address  
";}

```
if (rso.getValue() == Select One || rso.getValue() == ""){
    errorcode += "You must select a RSO

```

";}

```auto
 if (policy1.text == null || policy1.text == ""){
        errorcode += "You must enter your policy number
";}
        
    if (subpolicy1.text == null || subpolicy1.text == ""){
        errorcode += "You must enter your sub policy number
";}
        
    if (billgroup1.text == null || billgroup1.text == ""){
        errorcode += "You must enter your bill group number
";}
    
//error Alert        

    if (errorcode <> "") {
        Alert.show(errorcode,"Please try again... ");} 
        
    else {

    formData.sendAndLoad("http://x/email.php", replyData, "POST");}}

```

Thanks
