Expand my Community achievements bar.

A set of fields that equal 100%

Avatar

Level 2

I have a situation where I need to take four text fields and make them equal 100%. The fields them selves can vary in percent but the total of all four must equal 100 percent.

Could anyone reccomend the best way to script this or if an example exist lead me in that direction?

I have an attachment below of what I'm looking for visually.

Thank you! =)

4 Replies

Avatar

Level 6

Nikki, the script for this is easy but as usual the devil is in the details.  When do you want the values checked and how do you want the warning displayed?  Do you want it checked when the user tries to submit the form and have a message pop up?  Or, do you want a message displayed in real time.  For example the message will be displayed on the form until the four values add up to 100%; as soon as the user makes an entry in one of the fields that causes the total to equal 100% the message will disappear.  If the user changes a field again the message will re-appear.  Sort of an instruction/warning.

Also, must all four fields have a value not equal to zero, or can they enter 100, 0 ,0, 0?

Avatar

Level 2

Is there a way to make a warning message show if not all the 4 fields have

data including 0% as an option. Then once the four fields are populated if

the total percent does not equal 100% including the option for 100%, 0%, 0%,

0% another warning shows stating there needs to be a total of 100% for ABCD.

If you know this you are the master of LiveCycle!

Let me know if my description does not make sense. It is Friday. Thank you.

Avatar

Level 6

Nikki, try the attached example and let me know if it's working the way you want.  It's Friday for me too...

Avatar

Level 2

Thank you so much!

That will work perfect. I hope to get good enough some day to help others like you have helped me. Coming from a graphic design background learning all this JavaScript is a challenge. Thank you - I really appreciate the help.