<p>I was struggling with the same issue. Using your code I was able to get the select box to update by removing the <code>[]</code> at the end of your <code>select</code> <code>name</code> variable.</p>

<p>So this code wasn't working</p>

<p><code>&lt;select class="form-control" type="text" name="fields[userDivingCertification][ {{ block.id }}][fields][certificateType][]"&gt;</code></p>

<p>but changing to </p>

<p><code>&lt;select class="form-control" type="text" name="fields[userDivingCertification][ {{ block.id }}][fields][certificateType]"&gt;</code></p>

<p>got it submitting correctly.</p>

<p>The other issue I was having with the data being wiped completely was due to the hidden <code>type</code> field not having the correct value. I had copied some code from elsewhere and forgot to change the value. Once I got it matching my Matrix Block Type handle it worked fine.</p>

CC BY-SA 3.0
2017-04-25T14:25:39.997Z
2017-04-25T14:25:39.997Z
JxM
<p>Having a front-end user form where users can maintain there profile. I managed to get the single text and date field in the Matrix to be edited from the front-end but having issues with the select dropdown fields in the form.</p>

<p>The select dropdown is build up correctly but selected values won't save, in fact the existing value is cleared after submitting the form.</p>

<pre><code>&lt;form method="post" accept-charset="UTF-8"&gt;
    {{ getCsrfInput() }}
    &lt;input type="hidden" name="action" value="users/saveUser"&gt;
    &lt;input type="hidden" name="redirect" value="mijnduikteam/gegevens/{{ currentUser.username }}"&gt;
    &lt;input type="hidden" name="userId" value="{{ currentUser.id }}"&gt;

    &lt;input type="hidden" name="fields[userDivingCertification]" value=""

        &lt;div class="table-responsive"&gt;
            &lt;table class="table table-striped"&gt;
                &lt;thead&gt;
                    &lt;tr&gt;
                        &lt;th style="width: 20%;"&gt;Type&lt;/th&gt;
                        &lt;th style="width: 15%;"&gt;Certificaat #&lt;/th&gt;
                        &lt;th style="width: 20%;"&gt;Datum&lt;/th
                    &lt;/tr&gt;
                &lt;/thead&gt;
                &lt;tbody&gt;
                    {% for block in currentUser.userDivingCertification.order('certificateDate desc') %}
                    &lt;input type="hidden" name="fields[userDivingCertification][ {{ block.id }}][type]" value="certifications"&gt;
                    &lt;input type="hidden" name="fields[userDivingCertification][ {{ block.id }}][enabled]" value="1"&gt;

                        &lt;tr&gt;
                            &lt;td&gt;
                                &lt;select class="form-control" type="text" name="fields[userDivingCertification][ {{ block.id }}][fields][certificateType][]"&gt;
                                {% for option in block.certificateType.options %}
                                &lt;option {% if option.selected %}selected="selected"{% endif %} value="{{ option.value }}"&gt;{{ option.label }}&lt;/option&gt;
                                {% endfor %}
                                &lt;/select&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                                &lt;div class="input-group"&gt;
                                    &lt;input class="form-control" type="text" name="fields[userDivingCertification][ {{ block.id }}][fields][certificateNumber]" value="{{ block.certificateNumber }}" &gt;
                                &lt;/div&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                                &lt;div class="input-group"&gt;
                                    &lt;input class="form-control" type="text" id="datetimepickerCertificate" name="fields[userDivingCertification][ {{ block.id }}][fields][certificateDate][date]" value="{{ block.certificateDate| date('d-m-Y') }}" aria-describedby="basic-addon4" &gt;
                                &lt;span class="input-group-addon" id="basic-addon4"&gt;&lt;i class="fa fa-calendar"&gt;&lt;/i&gt;&lt;/span&gt;
                                &lt;/div&gt;
                            &lt;/td&gt;
                         &lt;/tr&gt;
                     {% endfor %}
                 &lt;/tbody&gt;
             &lt;/table&gt;
        &lt;/div&gt;
        &lt;div class="form-group" style="margin-top: 80px;"&gt;
                &lt;input role="button" class="btn btn-primary" type="submit" value="Wijziging bewaren"&gt;
        &lt;/div&gt;
    &lt;/form&gt;
</code></pre>

<matrix><users><form><user-profile>
Edit select dropdown field in a Matrix on the front-end
# Edit select dropdown field in a Matrix on the front-end

(Asked by: username_0 on 2015-09-03)

Having a front-end user form where users can maintain there profile. I managed to get the single text and date field in the Matrix to be edited from the front-end but having issues with the select dropdown fields in the form.
The select dropdown is build up correctly but selected values won't save, in fact the existing value is cleared after submitting the form.

    {{ getCsrfInput() }}
    
    
    

    
            
                
                    
                        Type
                        Certificaat #
                        Datum
                
                
                    {% for block in currentUser.userDivingCertification.order('certificateDate desc') %}
                    
                    

                        
                            
                                
                                {% for option in block.certificateType.options %}
                                {{ option.label }}
                                {% endfor %}
                                
                            
                            
                                
                                    
                                
                            
                            
                                
                                    
                                
                                
                            
                         
                     {% endfor %}

**Tags:** matrix, users, form, user-profile


---

## 1 answers

### Answer by username_1 on 2017-04-25. Score: 1

I was struggling with the same issue. Using your code I was able to get the select box to update by removing the `[]` at the end of your `select` `name` variable.

So this code wasn't working

but changing to

got it submitting correctly.

The other issue I was having with the data being wiped completely was due to the hidden `type` field not having the correct value. I had copied some code from elsewhere and forgot to change the value. Once I got it matching my Matrix Block Type handle it worked fine.


---

