This example shows how to use the preOpen event in a dropdown. This is the ideal event to use when dynamically setting the items that are available in the dropdown list. The script can be set to look at the values of other objects in the form and then populate the dropdown list based on these values.
I have amended the example, so that if the user deselects a checkbox the script in the click event will check to make sure that the user hasn’t already selected one of the choices in the dropdown. This is done using the string.search() method, which uses a regular expression. Check out the amended script in the click event of the checkboxes.