Welcome Guest, Not a member yet? Register   Sign In
Need help using valid_url rule reference
#6

I had the same issue.. I would post "224regqawergwgw" without any domain identifier and still return true for valid url...



My solution was to create a callback function and check the string with a filter.


PHP Code:
$this->form_validation->set_rules('add_website''website url''trim|required|callback_check_valid_url'); 



PHP Code:
public function check_valid_url$param )
{
 
 if( ! filter_var($paramFILTER_VALIDATE_URL) ){
 
   $this->form_validation->set_message('check_valid_url''The {field} must be a valid url');
 
   return FALSE;
 
 }else{
 
   return TRUE;
 
 }
 
 

Reply


Messages In This Thread
RE: Need help using valid_url rule reference - by gabrielcastillo - 11-06-2017, 10:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB