Welcome Guest, Not a member yet? Register   Sign In
How develop Model and validation
#11

(01-16-2020, 09:17 AM)InsiteFX Wrote: Always return true or false boolean that is the correct way of doing it.

But how do know what is error?
Example if mobile data is incorrect and i return false,i cannot know what is error
?
Reply
#12

It will be matched against a pre-defined message string (mobile). Or if you build a custom validation callback for that field and set different error messages depending of the mobile number.

But the function itself should always return true or false. But it can set different messages depending on what have failed.

https://codeigniter.com/user_guide/libra...ding-rules
https://codeigniter.com/user_guide/libra...on-methods
Reply
#13

(01-16-2020, 12:05 PM)jreklund Wrote: It will be matched against a pre-defined message string (mobile). Or if you build a custom validation callback for that field and set different error messages depending of the mobile number.

But the function itself should always return true or false. But it can set different messages depending on what have failed.

https://codeigniter.com/user_guide/libra...ding-rules
https://codeigniter.com/user_guide/libra...on-methods

Ohhh Thank you
Reply




Theme © iAndrew 2016 - Forum software by © MyBB