Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

How can I automically deselect a checkbox once the maximum number of checkboxes have been selected?

Avatar

Former Community Member

I found a script below online that works supposedly well. I just need to know how I can get this code to work in livecycle on my pdf form as I am a novice in coding. If someone can attach an example in pdf form that would be great. Thanks!

<SCRIPT LANGUAGE="javascript">
  
function KeepCount() {

var NewCount = 0

if (document.joe.dog.checked)
{NewCount = NewCount + 1}

if (document.joe.cat.checked)
{NewCount = NewCount + 1}

if (document.joe.pig.checked)
{NewCount = NewCount + 1}

if (document.joe.ferret.checked)
{NewCount = NewCount + 1}

if (document.joe.hampster.checked)
{NewCount = NewCount + 1}

  if (NewCount == 3)
{
alert('Pick Just Two Please')
document.joe; return false;
}
}
  </SCRIPT> 


I got this code from here: Checkboxes: Only Two

0 Replies