Expand my Community achievements bar.

SOLVED

Validate required fields are filled in

Avatar

Level 7

I have the JavaScript working to validate that the required fields are filled in. Although the focus is set on the field correctly, the script keeps displaying all the error messages one after the other forcing the user to click OK on each one until they can fill in the field.

I'm not sure what I'm doing wrong.

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 9

Hi,

Have you set the empty messages to display for all those required fields which are not filled in and calling the validation script before submitting it then, it would show all the alerts for left out required fields one by one. This becomes annoying.

Alternately you can do the following.

- Wrap field fields in a subform. It depends on you how many subforms do you want to sue.

- In the validation script you can call each subform validation one by one. For example you will call validation script of subform-1 which has many fields. If something is leftout then it would show error for that subform only. After that if the validation satisfies then the validation script of the second subform executes. So it would show the alerts one by one rather than in an annoying manner.

For ex :

if (form1.Page1.Page1_subform1.execValidate())
{
   if (form1.Page1.Page1_subform2.execValidate())
     {
            if (form1.Page1.Page1_subform3.execValidate())
              {
                  if (form1.Page3.Pag3_subform1.execValidate())
                    {
                 }
           }
       }
      
}
     
else
{

}

Thanks,

Bibhu.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 9

Hi,

Have you set the empty messages to display for all those required fields which are not filled in and calling the validation script before submitting it then, it would show all the alerts for left out required fields one by one. This becomes annoying.

Alternately you can do the following.

- Wrap field fields in a subform. It depends on you how many subforms do you want to sue.

- In the validation script you can call each subform validation one by one. For example you will call validation script of subform-1 which has many fields. If something is leftout then it would show error for that subform only. After that if the validation satisfies then the validation script of the second subform executes. So it would show the alerts one by one rather than in an annoying manner.

For ex :

if (form1.Page1.Page1_subform1.execValidate())
{
   if (form1.Page1.Page1_subform2.execValidate())
     {
            if (form1.Page1.Page1_subform3.execValidate())
              {
                  if (form1.Page3.Pag3_subform1.execValidate())
                    {
                 }
           }
       }
      
}
     
else
{

}

Thanks,

Bibhu.