We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22770
    • 285 Posts
    I have a simple radio group. The relevant chunk is:

    <ul class="radio">
    <li><input type="radio" name="reason" value="1" title="Enquiry about further information" class="radio" id="radio1" checked="checked" /><label for="radio1">Enquiry</label></li>
    <li><input type="radio" name="reason" value="2" title="Comment on the web site" class="radio" id="radio2" /><label for="radio2">Comment on the web site</label></li>
    <li><input type="radio" name="reason" value="3" title="Report a technical problem or error" class="radio" id="radio3" /><label for="radio3">Report a technical problem or error</label></li>
    </ul>


    I want the first option to be checked by default, and my understanding of HTML says it should be in this code. But the checked="checked" part of the code appears to be stripped out by eform. (At least it isn’t visible anymore when I view the source of the page.)

    Is there any reason why this is happening?

    Is my HTML wrong?

    I’m using eform 1.4.4.6 and MODx 0.9.6.3

    Thanks.
      • 30223
      • 1,010 Posts
      Are you sure you have eform 1.4.4.6? I just copied and pasted your mark-up and the value is correctly preserved in the resulting form.
      Due to some stupidity on my part the version numbering in the eform files was not updated correctly (1.4.4.6 still mentions 1.4.4.5) which makes it difficult to see what version is actually istalled.

      In eform.inc.php check around line 821 It should have this code:
      //<?php
         //if no postback, retain any checked values
          if(!$isPostBack && !empty($tagAttributes['checked'])) $fields[$name][]=stripTagQuotes($tagAttributes['value']);
      
        • 22770
        • 285 Posts
        You are quite right. I could have sworn I’d downloaded 1.4.4.6, but I guess not. I’ll update and check.

        Thanks.
          • 8522
          • 145 Posts
          I just had the problem that eform stripped checked="checked". Adding TobyL’s line on 821 fixed it. My current version is modx-0.9.6.3 that comes with eform 1.4.4.5.

          The current release candidate for modx-evolution (modx-1.0.0-rc1) doesn’t include the fix on line 821. It would be very nice though if it did smiley

          Are there plans to update to the latest eform 1.4.4.6 for modx-1? (this includes the fix)
          http://modxcms.com/extras/package/?package=123