On Wed, April 5, 2006 8:33 am, Lists said:
VJ, it sounds like you just want the _form item_ to be checked upon presentation of the form, and then the user will either "opt-out" or not.
In that case, you can simply change the HTML that displays the form under consideration. This would _visually_ make the box checked upon display, and if it remained checked, then it would be submitted as a subscription.
The HTML <input> element for type 'checkbox' can take 'checked' value.
Here is a comparison:
Checkbox input type that is not checked:
<input name="someWidget" type="checkbox" value="Subscribe">Checkbox input type that is checked:
<input name="someWidget" type="checkbox" value="Subscribe" checked>
Untrue. The correct syntax is as follows:
<input name="someWidget" type="checkbox" value="Subscribe" checked="checked" />
The ending / is only necessary if you are trying for XHTML compliance. The checked="checked" business is to make the tag both HTML and XHTML compliant, as value-less attributes don't exist in XML. By default Drupal outputs XHTML-compliant code. You should follow suit.
Of course, in the vast majority of cases you won't be writing a checkbox element yourself but calling the Drupal API for it, which will take care of making it properly formed for you. Drupal is nice like that. :-)
--Larry Garfield