Project

General

Profile

Actions

Anomalie #1771

closed

Contribution form dropdown no longer works

Added by Johan Cwiklinski about 1 month ago. Updated 20 days ago.

Status:
Fermé
Priority:
Normal
Category:
IHM
Target version:
Start date:
12/18/2023
Due date:
12/18/2023
% Done:

100%

Estimated time:
Version utilisée:

Description

Since #1760, all elements with nochosen class are no longer loaded, making them not working if they're not explicitely instanciated (that was the expected behavior orginally).


Files


Related issues 2 (0 open2 closed)

Has duplicate Galette - Anomalie #1772: Choix du type de contributionRejeté01/18/2024

Actions
Follows Galette - Anomalie #1760: Cannot enter a new social network nameFerméJohan Cwiklinski12/17/2023

Actions
Actions #1

Updated by Johan Cwiklinski about 1 month ago

  • Due date set to 12/18/2023
  • Start date changed from 01/18/2024 to 12/18/2023
  • Follows Anomalie #1760: Cannot enter a new social network name added
Actions #2

Updated by Johan Cwiklinski about 1 month ago

diff --git a/galette/templates/default/pages/contribution_form.html.twig b/galette/templates/default/pages/contribution_form.html.twig
index 1fb1b796d..47ea8c4de 100644
--- a/galette/templates/default/pages/contribution_form.html.twig
+++ b/galette/templates/default/pages/contribution_form.html.twig
@@ -41,7 +41,7 @@
     {% endif %}
                             <div class="inline field{% if required.id_type_cotis is defined and required.id_type_cotis == 1 %} required{% endif %}">
                                 <label for="id_type_cotis">{{ _T("Contribution type:") }}</label>
-                                <div id="id_type_cotis" class="ui dropdown selection nochosen">
+                                <div id="id_type_cotis" class="ui dropdown selection">
                                     {% if contribution.type %}
                                         {% set selectedid = contribution.type.id %}
                                     {% else %}

Cache (galette/data/cache/) must be removed after applying this patch.

I have to take a closer look, I'm pretty sure this is not the ony case that will fail :/

Actions #3

Updated by Johan Cwiklinski about 1 month ago

Actions #4

Updated by Guillaume AGNIERAY about 1 month ago

In fact, the nochosen class is a relic from 0.9 where it was used to prevent Selectize (and before that Chosen ; see 63cb4d) initialization on specific select elements.

As all dropdown are now rendered with Fomantic UI using either existing html or select elements, it can actually be removed from all templates : PR#404

Actions #5

Updated by Johan Cwiklinski about 1 month ago

Guillaume AGNIERAY a écrit (#note-4):

In fact, the nochosen class is a relic from 0.9 where it was used to prevent Selectize (and before that Chosen ; see 63cb4d) initialization on specific select elements.

As all dropdown are now rendered with Fomantic UI using either existing html or select elements, it can actually be removed from all templates : PR#404

In facts... This is still needed :/ Applying your PR makes #1760 back again.

I do not know exactly why, but having a global dropdown instanciation plus a local one do cause issues. That was also the original issue.

It would be OK to drop "nochosen" if we can be absolutely sure all local instanciations are processed after the global one, and properly replace it. In the past, none of those conditions were met.
Currently, I do not know if FUI properly replaces an already initilized element; but I think we never can be sure a local instanciation is processed after a global one :/

Actions #6

Updated by Guillaume AGNIERAY about 1 month ago

Johan Cwiklinski a écrit (#note-5):

In facts... This is still needed :/ Applying your PR makes #1760 back again.

I do not know exactly why, but having a global dropdown instanciation plus a local one do cause issues. That was also the original issue.

OK... I understand better. The original issue is not fixed.
That's why it is still impossible to add a new custom social network name.
As #1760 was closed, I thought it was fixed actually :D

It would be OK to drop "nochosen" if we can be absolutely sure all local instanciations are processed after the global one, and properly replace it. In the past, none of those conditions were met.
Currently, I do not know if FUI properly replaces an already initilized element; but I think we never can be sure a local instanciation is processed after a global one :/

Then, such dropdowns should not be initialized locally but the same way it is done with other "advanced" search dropdowns (see source:ui/js/common.js#L218), and redefined in the page template's javascripts block.

I've updated PR#404 accordingly ;)

Actions #7

Updated by Johan Cwiklinski about 1 month ago

Guillaume AGNIERAY a écrit (#note-6):

I've updated PR#404 accordingly ;)

I've just tested, and this still does not work. Previously, it was not possible to enter any value in the dropdown. With your latest changes, this is OK, but new entered value is not sent in post values

Sending the above form, we obtain social_new_type_1 = '' and social_new_value_1 = 'The name'

Updated by Guillaume AGNIERAY about 1 month ago

Johan Cwiklinski a écrit (#note-7):

I've just tested, and this still does not work.

On my side it does pretty well :/

  • When a social network is not found in the list, it is proposed to add it in the list :

  • When added to the list ( after clicking on "Add Test RS" above ) :

  • When saved :

Actions #9

Updated by Johan Cwiklinski about 1 month ago

Guillaume AGNIERAY a écrit (#note-8):

  • When added to the list ( after clicking on "Add Test RS" above ) :

Ooooooh, OK; that's what I've missed... There was no "add xyz" before.

Indeed that work that way, but the fact the entered text is displayed and the form can be submitted may confuse users (as I've been confused). I've no idea if it can be fixed UI side, but I'll take a look to add an error message on backend when that problem occurs.

Actions #10

Updated by Guillaume AGNIERAY about 1 month ago

Johan Cwiklinski a écrit (#note-9):

the fact the entered text is displayed and the form can be submitted may confuse users (as I've been confused). I've no idea if it can be fixed UI side, but I'll take a look to add an error message on backend when that problem occurs.

I've changed the behaviour on the frontend.
Now the entered text is directly added on input.

Actions #11

Updated by Johan Cwiklinski about 1 month ago

Guillaume AGNIERAY a écrit (#note-10):

I've changed the behaviour on the frontend.
Now the entered text is directly added on input.

Great, works like a charm :) Thanks!

Actions #12

Updated by Guillaume AGNIERAY about 1 month ago

  • Status changed from Nouveau to Résolu
  • % Done changed from 0 to 100
Actions #13

Updated by Johan Cwiklinski 20 days ago

  • Status changed from Résolu to Fermé
Actions

Also available in: Atom PDF