FriendsOfREDAXO / mform

Spielend einfach umfangreiche Modul-Input-Formulare erzeugen.
MIT License
77 stars 18 forks source link

Wert '0' wird nicht berücksichtigt. #300

Closed akuehnis closed 2 months ago

akuehnis commented 5 months ago

Description / Beschreibung

Wenn Choices den Key '0' enthalten dann wird der nicht berücksichtigt. Stattdessen wird bei der Formularverarbeitung der erste Wert der Liste gewählt.

<?php

 $box_paddings = [
        '-1' => 'Default (3)',
         '0' => 'Keiner', 
        '1'=>'0.25',
        '2'=>'0.5',
        '3'=>'1', 
        '4'=>'1.5', 
        '5'=>'3',

    ];

$mform = Mform::factory();
$mform->addSelectField("1.pt", $box_paddings, array('label'=>'Oben'), '1', '0', '-1'); 
echo $mform->show();

?>

Wenn man 'Keiner' auswählt wird MForm diesen Wert nicht übernehmen.

Quickfix: Die Auswahl umdrehen, das geht. Aber dem Kunden gefällts nicht so gut.

$box_paddings = [
         '0' => 'Keiner', 
        '-1' => 'Default (3)',
        '1'=>'0.25',
        '2'=>'0.5',
        '3'=>'1', 
        '4'=>'1.5', 
        '5'=>'3',

    ];

Affected versions / Verwendete Versionen Mform: 7.3.0

System report (REDAXO 5.15.1, PHP 8.2.12, MariaDB 10.6.15) | REDAXO | | | ------------: | :--------- | | Version | 5.15.1 | | PHP | | | ------------: | :--------- | | Version | 8.2.12 | | OPcache | yes | | Xdebug | no | | Database | | | ------------: | :-------------- | | Version | MariaDB 10.6.15 | | Character set | utf8 | | Server | | | ------------: | :--------- | | OS | Linux | | SAPI | cgi-fcgi | | Webserver | Apache | | Request | | | ------------: | :--------------- | | Browser | Chrome/120.0.0.0 | | Protocol | HTTP/1.0 | | HTTPS | yes | | Packages | | | ----------------------: | :---------- | | 2factor_auth | 2.1 | | accessdenied | 2.0.2 | | activity_log | 0.1.0 | | adminer | 1.9.3 | | analytics | 2.0.0 | | backup | 2.9.0 | | be_style | 3.2.0 | | be_style/redaxo | 3.2.0 | | bloecks | 3.1.1 | | bloecks/cutncopy | 3.1.1 | | bloecks/status | 3.1.1 | | cookie_consent | 3.0.0-beta3 | | developer | 3.9.2 | | focuspoint | 4.0.4 | | global_settings | 2.8.4 | | hyphenator | 1.3.0 | | install | 2.11.1 | | massif_minify | 1.3.3 | | mblock | 3.4.13 | | media_manager | 2.14.0 | | mediapool | 2.13.0 | | metainfo | 2.10.0 | | mform | 7.3.0 | | mform/docs | 1.1 | | minify_images | 2.2.0 | | pdfout | 8.0.1 | | phpmailer | 2.12.0 | | project | dev | | redactor2 | 4.2.1 | | search_it | 6.9.10 | | search_it/documentation | 6.9.10 | | sprog | 1.5.1 | | statistics | 3.0.1 | | structure | 2.15.0 | | structure/content | 2.15.0 | | structure/history | 2.15.0 | | useragent | 2.3.0 | | users | 2.10.0 | | watson | 2.3.0 | | yform | 4.1.1 | | yform/email | 4.1.1 | | yform/manager | 4.1.1 | | yform/tools | 4.1.1 | | yrewrite | 2.10.0 |
akuehnis commented 5 months ago

wo?

Sorry, Gitlab war zu schnell - hat's veröffentlicht bevor ich was schreiben konnte - nun sind die Infos ergänzt.

skerbis commented 5 months ago

Scheint verwandt mit https://github.com/FriendsOfREDAXO/mform/pull/284 zu sein

joachimdoerr commented 2 months ago

https://github.com/FriendsOfREDAXO/mform/commit/8d8f3d18efe4dd1b33c6797b98c3ca9205d6ca2b