Registration: authority selected after error in the form using POST value
authorLoic Baron <loic.baron@lip6.fr>
Thu, 15 Jan 2015 14:10:45 +0000 (15:10 +0100)
committerLoic Baron <loic.baron@lip6.fr>
Thu, 15 Jan 2015 14:10:45 +0000 (15:10 +0100)
portal/templates/onelab/onelab_registration_view.html
portal/templates/registration_view.html

index d3de3a6..703b4af 100644 (file)
                 {% if authorities %}
                     {% for authority in authorities %}
                         {% if authority.name %}
-                            <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
+                            {% if authority.authority_hrn == authority_hrn %}
+                                <option value="{{ authority.authority_hrn }}" selected>{{authority.name}}</option>
+                            {% else %}
+                                <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
+                            {% endif %}
                         {% else %}
+                            {% if authority.authority_hrn == authority_hrn %}
+                            <option value="{{ authority.authority_hrn }}" selected>{{authority.authority_hrn}}</option>
+                            {% else %}
                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
+                            {% endif %}
                         {% endif %}
-                    {% endfor %}    
+                    {% endfor %}               
                 {% else %}
                     <option value:"">No authority found !!!</option>
                 {% endif %}
index 8ad3bf5..4d09858 100644 (file)
                 {% if authorities %}
                     {% for authority in authorities %}
                         {% if authority.name %}
-                            <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
+                            {% if authority.authority_hrn == authority_hrn %}
+                                <option value="{{ authority.authority_hrn }}" selected>{{authority.name}}</option>
+                            {% else %}
+                                <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
+                            {% endif %}
                         {% else %}
+                            {% if authority.authority_hrn == authority_hrn %}
+                            <option value="{{ authority.authority_hrn }}" selected>{{authority.authority_hrn}}</option>
+                            {% else %}
                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
+                            {% endif %}
                         {% endif %}
-                    {% endfor %}    
+                    {% endfor %}
                 {% else %}
                     <option value:"">No authority found !!!</option>
                 {% endif %}