Search code examples
google-chromegrailsgsp

Found 2 elements with non-unique id while working with gsp pages in grails


I have created 2 radio buttons

<g:radio name="accountType" value="prepaid"/> PREPAID
<g:radio name="accountType" value="postpaid"/> POSTPAID

My chrome browser Version 67.0 started showing the following error

Found 2 elements with non-unique id

I found that id's must not be unique, but for radio buttons how come id's not to be unique.


Solution

  • Ids must be unique, but the name value can be shared

    <g:radio name="accountType" id="prepaid" value="prepaid"/> PREPAID
    <g:radio name="accountType" id="postpaid" value="postpaid"/> POSTPAID