You are viewing limited content. For full access, please sign in.

Question

Question

Is there javascript I can use to evaluate whether more than one checkbox is selected for a field?

asked on April 22, 2016

I have a Purchase Order form where the user selects the cost center(s) to which the purchase will be allocated.  I want to require another field where they will define how the cost is to be split, but this is only necessary if they select more than one cost center.  I know the script to use when checking to see if a specific checkbox is selected, but I am unsure of what script to use to evaluate whether more than one checkbox is selected out of all the options in that field.

 

Thank you!

0 0

Replies

replied on April 23, 2016

This is definitely possible using JavaScript, but why not use a table instead?

Have two columns: Cost Center (dropdown) and Amount to Allocate (currency)

You can set the minimum number of rows to 1 (so that they always have to allocate it to at least 1 cost center) but they can then add more and specify the amounts.

Then you can have a Total Amount field after the table that automatically sums up the Amount to Allocate fields (if you're on Forms 10).

JavaScript is very powerful, but it can make your forms difficult to maintain and change later down the road. It's better to use out of the box functionality whenever possible.

0 0
replied on April 25, 2016

This sounds like a great solution; however, I have already implemented the form, and now that they are used to just checking multiple boxes, I can see my users resisting having to hit "add" and specify a dropdown selection for each cost center they need to include on the purchase order.  I'm going to try this and see how much push back I get from them as to the amount of time it is taking, because I really like the concept and also the fact that it is less javascript in the form!  Thank you!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.