I have a multi-select for users to sign up for newsletters. When they edit their profile they need to be able to see which newsletters they are already signed up for. I have the code to output the entire options list or just the ones that they have selected but I haven't figured a way to add the selected attribute to the ones the user has selected.
{% set newsletters = craft.fields.getFieldByHandle('newsletters') %}
<select multiple>
{% for opt in newsletters.settings.options %}
<option value="{{ opt.value }}" >{{ opt.label }}</option>
{% endfor %}
</select>
The "for opt in newsletters.settings.options" can be changed to "for opt in newsletters.settings" to show just the ones the user has already selected.