• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.