11-17-2011 05:45 PM
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.
11-17-2011 05:45 PM
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
11-17-2011 05:45 PM
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.
11-17-2011 05:45 PM
DDR or JS.
On Submit add the values and if = 100 then nothing else error message and return false
11-17-2011 05:45 PM
That's an excellent start! Thank you for your feedback. I will investigate and report back!
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: