CodeIgniter Forums
Bug? Form Validation and fields with brackets - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Bug? Form Validation and fields with brackets (/showthread.php?tid=85855)



Bug? Form Validation and fields with brackets - groovebird - 12-13-2022

Hi,

i have a textfield and radiobutton with [] in the name to validate.

The rules are
PHP Code:
public $group1 = [
        'textfield.*' => [
            'label' => '...',
            'rules' => 'required'
        ],
    ];

public 
$group2 = [
        'radiobutton.*' => [
            'label' => '...',
            'rules' => 'required'
        ],
    ]; 

Via getErrors() i can see the generated error messages. For the textfield the key in the array is transformed to textfield.0 but for the radiobutton the key is still radiobutton.*. Under my radiobutton in the template there is no output of the message:
PHP Code:
showError('textfield.' $i// is working
showError('radiobutton.' $i// is not working 

Is this a bug? Otherwise how can i get the correct key -> radiobutton.0 instead of radiobutton.*?