CodeIgniter Forums
No limit() method bug in is_unique form validation? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: No limit() method bug in is_unique form validation? (/thread-54149.html)



No limit() method bug in is_unique form validation? - El Forum - 08-25-2012

[eluser]RecoilUK[/eluser]
Hi guys

So I am trying to use the is_unique form validation as below ...

Code:
$this->form_validation->set_rules('name', 'Name', 'required|alpha_numeric_relaxed|min_length[3]|max_length[100]|is_unique[businesses.bus_name]');

But I'm getting the following error message in the browser ...

Code:
Fatal error: Call to undefined method CI_DB_mysql_driver::limit() in C:\Users\Steve\http\system\libraries\Form_validation.php on line 954

So it looks like it can't find the limit() method to use it.

Can anybody help?

Thank You


No limit() method bug in is_unique form validation? - El Forum - 08-25-2012

[eluser]RecoilUK[/eluser]
Hi

OK, so I have solved the problem, it appears I had disabled the Active Record in the database config file, which this function needs.

Do you think the normal Database class needs a limit method to maintain functionality whilst it is disabled?

Thank You.


No limit() method bug in is_unique form validation? - El Forum - 08-25-2012

[eluser]Aken[/eluser]
The is_unique form validation rule requires active record. If you want to disable AR, you'll need to extend the form validation library and replace the is_unique rule with your own.


No limit() method bug in is_unique form validation? - El Forum - 08-26-2012

[eluser]RecoilUK[/eluser]
Hi

Yeah, I had come to that conclusion, I'll try and work out how to do it.

Thanks