I am using the form validation library however I have come across something I cannot work out how to do.
I have several fields,
I have:
- page_title => required
- menu_title => not required
- parent_id => null or required
Now if menu_title is not set then it should take on the value of page_title.
Then, I need to do a check to make sure that, at the given level the menu_title is unique.
So,
if($menu_title == '')
$menu_title = $page_title;
return $this->db->
select('menu_title')->
from('cart_categories')->
where(array('menu_title' => $menu_title,
'parent_id' => $category_parent))->
get()->num_rows() == 0;
But I don't know how to actually use that in the form validation library?