![]() |
Need help using valid_url rule reference - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Need help using valid_url rule reference (/showthread.php?tid=61734) |
Need help using valid_url rule reference - eldan88 - 05-11-2015 Hey Guys, I am trying to use the valid_url rule in CodeIgniter and it doesn't seem to be working. When I submit the form by just typing it "test" it doesn't display any kind of validation error. I'm not sure what is wrong here. If anyone can help me out I would really appreciate it. Thanks! PHP Code: private function validateForm(){ RE: Need help using valid_url rule reference - RobertSF - 05-11-2015 Is the required rule working? I ask because that code just sets up the rules. To send the submitted data to validation, you have to use. PHP Code: if ($this->form_validation->run()) RE: Need help using valid_url rule reference - eldan88 - 05-11-2015 Yes the required rule is working.I had to change the core function of valid_url... for some reason it wasn't working properly RE: Need help using valid_url rule reference - Narf - 05-12-2015 It is working properly, 'test' is a valid hostname and therefore a valid URL too, no matter how strange that may seem at first. RE: Need help using valid_url rule reference - Avenirer - 05-12-2015 @eldan88 what do you mean it wasn't working properly? "test" IS a valid url. If you want, after validation you can at any time do a prep_url() on the value. RE: Need help using valid_url rule reference - gabrielcastillo - 11-06-2017 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 ) |