Need help using valid_url rule reference |
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(){
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())
Hey, don't work without a PHP debugger. Several free IDEs have this features built in. Two are NetBeans and CodeLobster. Without a debugger, it's like you're driving with a blindfold on -- you are going to crash!
Yes the required rule is working.I had to change the core function of valid_url... for some reason it wasn't working properly
It is working properly, 'test' is a valid hostname and therefore a valid URL too, no matter how strange that may seem at first.
@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.
Website: http://avenir.ro
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 ) |
Welcome Guest, Not a member yet? Register Sign In |