CodeIgniter Forums
Make a Checkbox disabled - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Make a Checkbox disabled (/showthread.php?tid=13321)



Make a Checkbox disabled - El Forum - 11-18-2008

[eluser]bgougent[/eluser]
I have these lines of code in several forms, after validating (XHTML 1.1 Stricty) I get this error :
Quote:syntax of attribute value does not conform to declared value

The CI Code :
Code:
$inputpreferences   = array( 'name'        => 'commentflag',
                             'id'          => 'commentflag',
                             'value'       => 'N',
                             'checked'     => false,                                                    
                             'disabled'    => ''
                            );
echo form_checkbox($inputpreferences).'some text';

This is the actual HTML result :
Code:
<input type="checkbox" name="commentflag" value="N" id="commentflag" disabled=""  />

What the actual result should be :
Code:
<input type="checkbox" name="commentflag" value="N" id="commentflag" disabled  />

Is there a correct way in CI 1.6.3 to solve this problem?


Make a Checkbox disabled - El Forum - 11-18-2008

[eluser]Nick Husher[/eluser]
What you want to do is 'disabled'=>'disabled'. XHTML doesn't allow for attribute minimization, so you're required to duplicate the name in the value field:

Code:
<input type="checkbox" name="commetflag" value="N" id="commentflag" disabled="disabled" />