⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

set_rules regex_match not working



Faisal Naseer
  • profile picture
  • Member

Posted 26 July 2016 - 15:08 PM

I am trying to create regex validation on a field  named start_time in particular table

$crud->set_rules('start_time','Start Time','regex_match[/^(?:07:30|(0[8-9]|1[0-6]):[03]0)$/]');

reg ex is completed tested on regex101.com

but as I add or edit field I come across with error Unable to access an error message corresponding to your field name Start Time.(regex_match[/^(?:07:30)

 

 

 


Amit Shah
  • profile picture
  • Member

Posted 28 July 2016 - 11:10 AM

Hi there,

 

If u refer to the set rules documentation - this is the same as the codeigniter rules.

https://codeigniter.com/user_guide/libraries/form_validation.html#setting-validation-rules

 

What you should be doing here to have a workaround is callback method where u do the processing of the data validation.

look for the line below in the url above - it will give u the example for what i am saying

$this->form_validation->set_rules('username', 'Username', 'callback_username_check')

 

Happy GCing :)