CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Modifying validation rules
Pages: [1]

Author Topic: Modifying validation rules  (Read 2563 times)

awarnock

  • Guest
Modifying validation rules
February 20, 2009, 02:37:31 pm
I'm using CiviCRM v2.2 running standalone on a Fedora Core 10 Linux box.

When I try to import data into a website field of the form "civicrm.org", I get an error message complaining about the format.  It's close enough to a valid URL for me - is there some easy way to modify the validation rule that's checking the URL format to allow such entries to be imported?

Thanks.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Modifying validation rules
February 20, 2009, 05:34:07 pm

CRM/Utils/Rule.php, function url

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

kmitz

  • I post occasionally
  • **
  • Posts: 74
  • Karma: 2
Re: Modifying validation rules
February 15, 2010, 07:17:24 am
Comment out the line shown below:

Code: [Select]
static function url( $url, $checkDomain = false)
    {
        $options = array( 'domain_check'    => $checkDomain,
                          'allowed_schemes' => array( 'http', 'https', 'mailto', 'ftp' ) );

        require_once 'Validate.php';
        //return Validate::uri( $url, $options );  <- comment out this line
    }

longjon

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.5.6
  • CMS version: Wordpress 4.1
  • MySQL version: 5.5.442
  • PHP version: 5.4.38
Re: Modifying validation rules
February 25, 2015, 03:29:05 pm
Sorry to open up an old thread but I'm having the same problem in 4.5.6, and the code in rule.php now looks like this:
Code: [Select]
  static function url($url) {
    //return (bool) filter_var($url, FILTER_VALIDATE_URL);
  }

...which doesn't seem to have had the desired effect (ie. allowing www.wibble.org, rather than enforcing http://www.wibble.org) am I missing something?


longjon

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.5.6
  • CMS version: Wordpress 4.1
  • MySQL version: 5.5.442
  • PHP version: 5.4.38
Re: Modifying validation rules
February 26, 2015, 06:26:58 am
OK so that's not the thing to do and means that pretty much anything fails the validation. I ended up just adding the http:// globally onto all the records. But I still think enforcing this is a bit draconian.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Modifying validation rules

This forum was archived on 2017-11-26.