CodeIgniter Forums

Full Version: A little problem with valid_url
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hello! It's my first message. I'm developping my first project in codeigniter.

I found 1 problem.

The filter of url in the form doesn't work with codeigniter 2.0.3:
Code:
$this->load->library('form_validation');
$this->form_validation->set_rules('url', 'Url', 'valid_url');

but is defined in the form_validation_lang.php

Code:
$lang['valid_url'] = "The %s field must contain a valid URL.";

I added this function in
Code:
/**
    * Validate URL Address
    *
    * @access    public
    * @param    string
    * @return    bool
    */
    function valid_url($str)
    {
        return (bool) filter_var($str, FILTER_VALIDATE_URL);
    }

and now it work correctly (in PHP 5.3). It's a bug o I have to implement it?

Thanks!