Make some coffee or open another Dr Pepper, because this one is really fun:
Create a product template. Give it any name.
Add a customer field. Make it a RadioButtonList or CheckboxList type. I used RadioButtonList.
Add one choice. Set the choice name to "Non-cancelable, non-returnable." and make the value EXACTLY the same "Non-cancelable, non-returnable."
Mark your one choice Selected.
Now find a product with variants. Ideally a product that will render multiple dropdowns on the product page but at least one variant dropdown should be enough.
Assign the new product template to the product.
Preview the product.
When the product renders, you correctly see the variant dropdown(s) from BuyProductDialog.
You also correctly see one radio button choice, selected by default, for your customer product template you added.
Capture.JPG
(13kb) downloaded 0 time(s).Now make a variant selection in a dropdown. During the postback, the radio button choice is toggled off. Now it's not selected.
Make another variant selection. Again, the postback fires and again toggles the radio button choice. Now it's back to selected.
Rinse and repeat. The radio button choice keeps alternating between on or off with each postback.
The cause:
In the ProductController.GetProductTemplateFields() routine, the code correctly parses for the control type (checkbox, radiobuttons etc). However it's trying to split the choice values from the customer input control assuming a comma separates each choice. Except this is a single choice. There's only one possible value and splitting the string is not appropriate.
And.........splitting the string based on the comma, when the actual choice value already contains a comma (Non-cancelable, non-returnable.), results in the wrong value being parsed (Non-cancelable). Since the value 'Non-cancelable' doesn't match 'Non-cancelable, non-returnable.', the control is not marked as selected.
This is what causes the UI control to toggle with each postback.
End result: You can't use a comma in the value of a choice for a product template that is based on the checkbox, radiobuttonlist etc controls.
I'm going to remove the comma from the choice value. I'll let you guys figure out how to fix that code :)