inspiredminds / contao-fieldset-duplication

Contao extension to allow the duplication of form fieldsets in the front end by the user for additional input fields.
GNU Lesser General Public License v3.0
13 stars 6 forks source link

Add support for terminal42/contao-mp_forms #15

Closed qzminski closed 2 years ago

qzminski commented 2 years ago

This pull request adds support for terminal42/contao-mp_forms.

One thing to note is that I have removed the label increasing count. For example, if you add 3 items and go back to this view (whether it is MP Forms page switch or a form validation error), then the fieldsets and labels look like this:

  1. Person: Name, E-mail.
  2. Person 1: Name 1, E-mail 1.
  3. Person 2: Name 2, E-mail 2.

What's the problem? When you duplicate a fieldset via JS now, it will not update the legend and labels, resulting in:

  1. Person: Name, E-mail.
  2. Person 1: Name 1, E-mail 1.
  3. Person 1: Name 1, E-mail 1.
  4. Person 2: Name 2, E-mail 2.

Or

  1. Person: Name, E-mail.
  2. Person 1: Name 1, E-mail 1.
  3. Person 2: Name 2, E-mail 2.
  4. Person 2: Name 2, E-mail 2.

All depending which fieldset you duplicate. I tried to change this behavior in JS, but that would require "reindexing" all fieldsets. To do that I'd rewrite whole JS code probably, which I didn't want to do just yet.

Thus, I decided to remove the increasing labels. They were a bit inconsistent anyway, because when you duplicate fieldsets via JS the legends/labels did not change. However if you revisit the page, then the labels suddenly change to what's listed above.

I am looking forward to your feedback!

fritzmg commented 2 years ago

Thus, I decided to remove the increasing labels.

That's fine with me. You can also append a number purely with CSS anyway, if you really want a number.