Jean
Jean

Reputation: 83

Gravity Forms One product selected

I use Gravity Forms with Product fields. I have 6 different products with specific conditional logic for each one. My customer has to choose only one product. But by default, he can choose more than one product.

I try a lot of solutions without success. --> With conditional logic (Show and Hide): If any product is Selected then Hide the others --> With Populate Anything (From Gravity Wiz) and another form --> With an alert when more than one product is selected, but I cannot have a "reset" button to unselect all

If anyone has an idea or could give me advice it will help so so much...

Thank you

Upvotes: 0

Views: 451

Answers (1)

Rochelle
Rochelle

Reputation: 633

You could try the following:

Assuming your product types are radio button types, add "product_choice" to the 'Custom CSS Class' under the appearance tab for all 6 products.

Then add the following jquery script to the form (The easiest way is to use Gravity Forms Custom Javascript add on by Gravity Perks in my opinion)

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

This will make it so that when a customer chooses one product, the others will deselect.

Upvotes: 2

Related Questions