Label in Form Validation |
How do I put the name of the label in validation?
Not the field name. in codeigniter 3 I did this PHP Code: $this->form_validation->set_rules('first_name','First Name','required'); how do i do this codeigniter n 4? I'm trying this, but I can not. PHP Code: $validation->setRule('first_name','First Name','required'); This also does not work PHP Code: $validation->setRules(['first_name' => 'First Name', 'required']);
CodeIgniter 4 Users Guide - Validation
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I have not found anything in the documentation so that the name of the label can appear, not the field.
you can post an example of how I can do this?
If codeigniter 4 can not do this, I'm wasting time.
pois terei muito trabalho para criar uma menssagem personalizada para cada validação de cada campo de formulário. Does anyone have a solution?
PHP Code: public function email_agreement()
Simpler is always better
I do not want it this way.
I do not want to use custom error message for each field. This is very laborious if I have a large form. I want to use codeigniter's own messages 4. but I want the Label name to be displayed instead of the field name. Field Name = first_name Label Name = First Name (Display this)
Currently, I don't think you can. I'd like to do it that way too. It's less code.
Simpler is always better
Currently, no, it doesn't work like the old way. We are open to PR's though, to improve it. I'm slammed with work right now and am not getting much extra time to put into it for the next few weeks, likely.
At the very least, add an issue at GitHub. Though I don't see a really elegant way to handle it with the current system. Am open to suggestions on syntax that works with the current system and doesn't require an entire rework to match the old way just because we're comfortable with it. ![]()
I think an alternative syntax to what we have would be more user friendly
PHP Code: $validation->setRule('first_name', 'required', [ |
Welcome Guest, Not a member yet? Register Sign In |