We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15765
    • 1 Posts
    Don’t work "checked" in radio. Can someone help me?
      • 10525
      • 247 Posts
      I’m having (what sounds like) the same issue.

      I enter the following code:
      <td>
      	<input type="radio" name="acs" value="yes" /> Yes 
      	<input type="radio" name="acs" value="no"  checked /> No
      </td>

      but no radio button is selected in my webpage.
      The resulting source code from the browser is:
      <td>
      	<input type="radio" name="acs"  value="yes"  /> Yes 
      	<input type="radio" name="acs"  value="no"  /> No
      </td>


      The checked attribute is stripped out whether I try "checked", "checked=’checked’" or "checked=’yes’".

      Can anyone suggest what is causing this and how I can successfully implement default radio buttons with eForm?

      Thanks.

      MODx: 2.0.2
      eForm: 1.4.4.6
      PHP: 5.2.12

        • 10525
        • 247 Posts
        Allow me to reply to myself.

        According to the post http://modxcms.com/forums/index.php/topic,37096.0.html, using checked=’checked’ works. I tried this and it does indeed work.

        I had actually stated in my previous post that I had tried this but had actually tried checked="checked" and changed the single/double quotes for the sake of explanation, not realising the significance of my punctuation.

        I’m pleased it works now, but the question remains, why does an html attribute work only with single quotes when other attributes generally work with double quotes? I have never seen this documented anywhere for eForm.

        Cheers,

        Gav