The #display_string logic sets a checkbox to display:none yet the checkbox is #required => true.
I duplicated the conditional to also set #required => false if no required_product selected.
$display_string = $form_state['values']['required_product'] != '' ? '' : ' style="display: none;"';
$form["discount_set"]["limit_max_times_applied"] = array(
"#type" => "checkbox",
"#title" => t("Further limit maximum applications to number of Required Products in cart."),
"#description" => t("Allows for a discount like 'Get half off X for each Y that is purchased.'"),
"#default_value" => isset($form_state["values"]["limit_max_times_applied"]) ? $form_state["values"]["limit_max_times_applied"] : FALSE,
"#size" => 7,
"#required" => $form_state['values']['required_product'] != '' ? TRUE : FALSE, // <--- changed line of code
'#prefix' => "<div id=\"discount-limit-max-times-applied-wrapper\"$display_string>",
'#suffix' => "</div>",
);
Comments
Comment #1
pwilson commentedSubscribing. Possible workaround is to set a required product, check the checkbox, and then deselect the required product.
Comment #2
jrust commentedActually, couldn't find any reason for that checkbox to be required, so removed the requirement.