Search code examples
formsamp-html

amp-list form radio not defaulting to checked


I am trying to use amp-list to show products and allow users to select quantity before they add to cart. It doesnt appear to want to work when its within an amp-list however.

Here is an example of what I'm talking about. You can see at the very bottom of the page theres an input type=radio which allows for checked=checked but within the amp-list it doesnt work as expected.

<amp-list id="paged-amp-list" layout="fixed-height" height="700" src="https://ampbyexample.com/advanced/paged_list/search" [src]="'https://ampbyexample.com/advanced/paged_list/search?page=' + pageNumber" single-item>
    <template type="amp-mustache">
      ....
          <input type="radio" id="quantity-1" name="Quantity" value="1" checked="checked"> 1
      ....
    </template>        
  </amp-list>

https://codepen.io/anon/pen/QQJEMN


Solution

  • Because those radio inputs using same name.

    codepen.io/buihoanghai/pen/vdQJdG