Gravity Forms 选择了一个产品

Gravity Forms One product selected

我在产品字段中使用重力表。 我有 6 种不同的产品,每一种都有特定的条件逻辑。 我的客户只能选择一种产品。 但默认情况下,他可以选择不止一种产品。

我尝试了很多解决方案都没有成功。 --> 使用条件逻辑(显示和隐藏):如果选择了任何产品,则隐藏其他产品 --> 使用 Populate Anything(来自 Gravity Wiz)和另一种形式 --> With an alert when more than one product is selected, but I cannot have a "reset" button to unselect all

如果有人有想法或可以给我建议,那将非常有帮助...

谢谢

您可以尝试以下方法:

假设您的产品类型是单选按钮类型,将 "product_choice" 添加到所有 6 种产品的外观选项卡下的 'Custom CSS Class'。

然后将以下 jquery 脚本添加到表单中(我认为最简单的方法是使用 Gravity Perks 的 Gravity Forms Custom Javascript 添加)

$('.product_choice input[type="radio"]').on('change',function(){
  $('.product_choice input[type="radio"]').each(function(){
    $(this).prop('checked', false);
  });
  $(this).prop('checked', true);
});

这将使当客户选择一个产品时,其他人将取消选择。