![]() |
I must hack Validation library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: I must hack Validation library (/showthread.php?tid=7456) |
I must hack Validation library - El Forum - 04-09-2008 [eluser]Lima[/eluser] Sorry I must hack Validation Library (system/libraries/Validation.php) In the end of method run we'll see Code: foreach ($this->_error_array as $val) In my case, I use property error_string on JavaScript. It show error on JavaScript because "\n". example : Code: window.alert("The User field is required. so I must hack this library like this (without "\n") because nothing else I can do Code: foreach ($this->_error_array as $val) if we need "\n" use set_error_delimiters Do I do the right thing? I need another opinions. Thanks. I must hack Validation library - El Forum - 04-09-2008 [eluser]wiredesignz[/eluser] Create a MY_Validation extension in application/libraries, add your overrides by copying and modifying the original Validation functions. Refer to the User Guide or search the forums on "Core Extensions". This forum is for CI code contributions not for problem solving. Post your problems in Code & Application Development. I must hack Validation library - El Forum - 04-09-2008 [eluser]barbazul[/eluser] Even easier: replace php breaklines ("\n") and make them look like javascript encoded breaklines ("\\n")... that way javascript wont complaint and will even respect your breaklines ![]() Code: window.alert("<?=str_replace("\n","\\n",$this->validation->error_string); ?>"); I must hack Validation library - El Forum - 04-10-2008 [eluser]Lima[/eluser] OK, thank for your opinions. I think both of you right. |