Expand my Community achievements bar.

Compare form fields to validate

Avatar

Level 1

Hello,

I am new to ES Designer and I don't have javascript experience so I'm looking for some help on a form I am working on.

I have a total field page one. This total represents the grand total of clients.

The next pages have the total client information broken out by demographics & re-totaled.

If entered correctly, the total for each set of demographics should equal the grand total on the first page.

Is there a way to compare these demographic total fields to the grand total field to be sure that they match?

If they don't match, can an error message be displayed to instruct the user?

I have the calculations working (using formcalc) to create totals.

Any help is greatly appreciated!

Thank you.

I'm using ES Designer 8.2

4 Replies

Avatar

Former Community Member

You could calculate the grand total on page one using the totals from each demographic. Upon submission or print you could check that every total for each demographic is populated so the grand total on page one reflects all demographics.

Steve

Avatar

Level 1

Thanks so much for the reply.

I'm not sure if that will work for me since the grand total on page one is used to total the sum of two fields on page 1.

Here is a little more info on the form & an outline of the form. I have 5 sets of demographics all with a unique number of breakout/"type" information that must be added up & equal the grand total. The total for each demographic must be equal to the grand total, but the breakout of the total must be assigned in the "type" fields. The function of the Demographics is to require the breakout demographic information and verify that it matches the grand total.

I hope this helps with troubleshooting/ideas.

Page 1 - Total Clients

Information #1 = 100

Information#2 = 100

Total = 200

Page 2 - Client Information

Demographic 1 (gender)

type1 =

type 2 =

type 3 =

type4 =

total = Must Equal 200

Demographic 2 (age)

type1 =

type 2 =

type 3 =

type4 =

type 5 =

total = Must Equal 200

Demographic 3 (area)

type1 =

type 2 =

type 3 =

type4 =

type 5 =

type 6 =

type 7 =

type 8 =

total = Must Equal 200

Avatar

Level 1

I'm making some progress ( I hope)

I was able to add a validation to the demographic total fields that checks that the demographic total is equal to the page 1 total

Using FormCalc:

grandtotal == demographic1total

The validation is working but I am getting a validation error message when I click in each demographic information field because the total field is being caluclated as each field is changed.

Is there a way to have the calculation wait until all the demographic information has been entered?

Can I add a button to intiate the calculation in the demographic total field? (if so, how would I do that?)

Thanks so any help you can offer.

I am really new to this & I have a lot to learn. This validation requirement is over my head.

Avatar

Former Community Member

The following FormCalc calculation script requires all values to be populated before calculating the total.

// form1.page1.subform1.total::calculate - (FormCalc, client)


if (a.isNull | b.isNull | c.isNull) then

  $.rawValue = null

else

  $.rawValue = a + b + c

endif

Steve