cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
643
Views
0
Helpful
4
Replies

Calculating values of fields and preventing submission

Calculating values of fields and preventing submission

Dear All,

We have some fields on one of our forms that must add up to 100% and ideally prevent submission if they do not. At the moment, we rely on the customer filling out the form to get the split correct, but it would be a great help if we could calculate these values and provide feedback.

Please find a screenshot of the particular AFC below. And thoughts or suggestions would be greatly appreciated.

Image inserted by author 

4 Replies 4

In 2008, your choices are JavaScript or a data retrieval rule.

SQL-entry data retrieval rule would probably be simpler: Just select the sum of the fields (from Oracle, select from dual) into a hidden (or not) field. (In SQLServer, it's just select, without the dual):

select (#Dict.AllocatedPct1# + #Dict.AllocatedPct2# + #Dict.AllocatedPct3#...) AS Alias from dual

mapping the alias column to the HiddenField (or not) on the AFC

Since data retrieval rules (unlike fetch [RIP]) are per

Beverly Boden
Level 1
Level 1

I have a similar requirement and accomplished it using javascript in 2008.3 version. I did not think to use data retrieval rule functionality. In addition, I am not following your syntax from dual statement for SQLServer, but let me try it. Thanks.

Emir E
Level 1
Level 1

DDR or JS.

 

On Submit add the values and if = 100 then nothing else error message and return false

That's an excellent start! Thank you for your feedback. I will investigate and report back!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: