Welcome Guest, Not a member yet? Register   Sign In
Disable valitation rule
#1

(This post was last modified: 01-04-2022, 12:55 PM by sprhld.)

Hallo!

I'm still working with validations. All rules and messages are in my model. Now I have a case, where some rules should not use.
This are my rules


PHP Code:
        'name'    => 'required|regex_match[/[a-zA-Z ÄäÖöÜüß]/]|min_length[2]',
        'street_no' => 'required|regex_match[/[a-zA-Z0-9 ÄäÖöÜüß]/]|min_length[5]',
        'city'      => 'required|regex_match[/[a-zA-Z ÄäÖöÜüß]/]|min_length[3]',
        'birthday'  => 'required|trim|valid_date'


And this is the array for the insert()


PHP Code:
                'name'    => $data['nachname'],
                'birthday'  => $data['geburtstag'], 


And the error appears that street_no and city is also required.

Is it possible to switch those not used rules off for some querys? Here in our forum I read, it is better to set the rules instead of unset. But IMO this is for valitation via controller. In model it is more "hardcoded", right?
Reply


Messages In This Thread
Disable valitation rule - by sprhld - 01-04-2022, 12:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB