CodeIgniter Forums
How develop Model and validation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How develop Model and validation (/showthread.php?tid=75210)

Pages: 1 2


RE: How develop Model and validation - omid_student - 01-16-2020

(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
?


RE: How develop Model and validation - jreklund - 01-16-2020

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/libraries/form_validation.html#cascading-rules
https://codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods


RE: How develop Model and validation - omid_student - 01-19-2020

(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/libraries/form_validation.html#cascading-rules
https://codeigniter.com/user_guide/libraries/form_validation.html#callbacks-your-own-validation-methods

Ohhh Thank you