Reputation: 171
Is there a way to limit how many checkboxes can be checked in Powermail form (Typo3 v7)?
Upvotes: 0
Views: 320
Reputation: 171
We have to write our own validator. Typo3 add some variables within name attribute and this variable has to be read out. It looks like this:
name="tx_powermail_pi1[field][variable][]
Below an example with jquery.
$("input[name*='variable']").change(function(){
var max= 3;
if( $("input[name*='variable']:checked").length == max ){
$("input[name*='variable']").attr('disabled', 'disabled');
$("input[name*='variable']:checked").removeAttr('disabled');
}else{
$("input[name*='variable']").removeAttr('disabled');
}
});
More info https://docs.typo3.org/typo3cms/extensions/powermail/ForDevelopers/WriteOwnValidators/Index.html
Upvotes: 1