@@ -283,7 +283,7 @@ public function open(): string
283
283
if ($ this ->_Fmethod !== 'get ' ) {
284
284
$ ret .= csrf_field ();
285
285
286
- if ($ this ->_Fmethod !== 'post ' ) {
286
+ if ($ this ->_Fmethod !== 'post ' && $ this -> _Fmethod !== ' get ' ) {
287
287
$ ret .= method_field ($ this ->_Fmethod );
288
288
}
289
289
}
@@ -649,20 +649,32 @@ private function _getLabel(): string
649
649
*/
650
650
private function _buildAttrs (array $ props = [], array $ ignore = []): string
651
651
{
652
+ $ props = array_merge (array_filter ($ this ->_attrs , function ($ k ){
653
+ return $ k != 'class ' ;
654
+ }, ARRAY_FILTER_USE_KEY ), $ props );
652
655
653
- $ props ['type ' ] = $ this ->_type ;
654
- $ props ['name ' ] = $ this ->_name ;
656
+ if ($ this ->_type ){
657
+ $ props ['type ' ] = $ this ->_type ;
658
+ }
659
+
660
+ if ($ this ->_name ){
661
+ $ props ['name ' ] = $ this ->_name ;
662
+ }
655
663
656
664
if (!is_null ($ this ->_autocomplete )) {
657
665
$ props ['autocomplete ' ] = $ this ->_autocomplete ;
658
- } else if (isset ($ this ->_allowedAutoComplete [$ props ['name ' ]])) {
659
- $ props ['autocomplete ' ] = $ props ['name ' ];
666
+ } else if ($ this ->_name && isset ($ this ->_allowedAutoComplete [$ this ->_name ])) {
667
+ $ props ['autocomplete ' ] = $ this ->_name ;
668
+ }
669
+
670
+ $ id = $ this ->_getId ();
671
+ if ($ id ){
672
+ $ props ['id ' ] = $ this ->_getId ();
660
673
}
661
674
662
- $ props ['id ' ] = $ this ->_getId ();
663
675
$ props ['class ' ] = isset ($ props ['class ' ]) ? $ props ['class ' ] : '' ;
664
676
665
- if ($ this ->_type == 'select ' && $ this ->_multiple ) {
677
+ if ($ this ->_type == 'select ' && $ this ->_multiple && $ this -> _name ) {
666
678
$ props ['name ' ] = $ props ['name ' ] . '[] ' ;
667
679
}
668
680
0 commit comments