                                         $editProfileForm.trigger 'submit'
 
                                     $editProfileModal.on 'show.bs.modal', (e) ->
-                                        $editProfileSubmitError.text ''
-
-                                    $editProfileModal.on 'shown.bs.modal', (e) ->
                                         $('#edit-profile-country').val(team.country).focus()
                                         $('#edit-profile-locality').val team.locality
                                         $('#edit-profile-institution').val team.institution
+                                        $editProfileSubmitError.text ''
+
+                                    $editProfileModal.on 'shown.bs.modal', (e) ->
+                                        $('#edit-profile-country').focus()
 
                                     $editProfileForm.on 'submit', (e) ->
                                         e.preventDefault()

                                        $changePasswordForm.trigger 'submit'

                                    $changePasswordModal.on 'show.bs.modal', (e) ->
                                        $changePasswordSubmitError.text ''

                                    $changePasswordModal.on 'shown.bs.modal', (e) ->

                                            $resendConfirmationForm.trigger 'submit'

                                        $resendConfirmationModal.on 'show.bs.modal', (e) ->
                                            $('#resend-confirmation-email').val team.email
                                            $resendConfirmationSubmitError.text ''

                                        $resendConfirmationModal.on 'shown.bs.modal', (e) ->
                                            $('#resend-confirmation-email').focus()

                                        $resendConfirmationForm.on 'submit', (e) ->
                                            e.preventDefault()
