Highlighted

Validation Message Problem

Avatar

11-12-2008

Hi



Let me describe my scenario briefly as follow:



1. I have no. of numeric fields (variable in count) available on my form. Lets name them as Weightages.

2. User enters values in those numeric fields (Weightages).

3. Before submitting the form, I want to validate whether the sum of all those numeric fields (Weightages) is equal to 100 or not.



What solution I implemented is that I pasted a hidden field on my form named as TotalCount. On the "PreSubmit" event of my form, I sum up all the Weightages and assign the total value to TotalCount (hidden field). On the "Validate" event of TotalCount (hidden field), I checked teh value of that field should be equal to 100 otherwise, Submit action should be cancelled.



The solution is working very fine. The only problem which I am facing is that I am getting the same validation error message two times.



So what is the solution to get that specific validation error message only once?



Thanks in advance.

synaqvi

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

12-12-2008

Don't do it on presubmit ...do it on Calculate. If you do it that way you will not have to trigger the calculate it will happen as the fields are being filled out. Then put a validate script on the total field ensuring that it equals 100. When submit is pressed, the validat will fire and if a false is returned the submit will cancel itself.
Highlighted

Avatar

14-12-2008

Dear Paul



I cannot script it in calculate event as the no. of weightages fields are variable (using tables). So every time I enter any value for any weightage field, system gives me validation error (for total field). But I want to see the error only once. Please advise.



Thanks in advance.

synaqvi