Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

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


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;

I got this code from here: Checkboxes: Only Two

0 Replies