ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Safecracker, valid_ip validation rule

March 19, 2012 5:07pm

Subscribe [2]
  • #1 / Mar 19, 2012 5:07pm

    Bransin

    157 posts

    http://ellislab.com/expressionengine/user-guide/modules/safecracker/index.html#rules-my-field-name

    Add additional validation rules to your fields. Separate multiple rules with the pipe | character. You may use the native CodeIgniter rules (required, matches, min_length, max_length, exact_length, alpha, alpha_numeric, alpha_dash, numeric, integer, is_natural, is_natural_no_zero, valid_email, valid_emails, valid_ip, valid_base64), and these additional ExpressionEngine-specific rules: valid_ee_date.

    The safecracker documentation mentions that valid_ip can be used as a validation rule. I receive this in error when trying to use valid_ip validation on a field.

    A PHP Error was encountered
    Severity: Notice
    Message: Undefined property: Safecracker_lib::$input
    Filename: libraries/Form_validation.php
    Line Number: 1038
    
    Fatal error: Call to a member function valid_ip() on a non-object in /system/codeigniter/system/libraries/Form_validation.php on line 1038

    The snippet of code I am using.

    {exp:safecracker site="site1" class="site_form" entry_id="{segment_2}" channel="test" author_only="yes" include_jquery="no" safecracker_head="no" error_handling="inline" rules:your_ip_address="integer|valid_ip"}

    Input inside of safecracker pair tags.

    <label for="your_ip_address">IP Address</label>
     <input type="text" id="your_ip_address" name="your_ip_address" value="{if your_ip_address}{your_ip_address}{if:else}{ip_address}{/if}" maxlength="45" tabindex="3">
     {if error:your_ip_address}<span class="error">{error:your_ip_address}</span>{/if}
    

     

  • #2 / Mar 20, 2012 6:35pm

    Sean C. Smith

    3818 posts

    Hi Bransin,

    I have replicated your error on my sandbox install and I’ve filed a bug report for you on this issue. I encourage you to comment on that thread in order to keep informed of the status of the fix. I know that doesn’t help you right now, but follow the thread and you’ll be notified of the fix when it’s available.

    Sean

  • #3 / Mar 20, 2012 6:40pm

    Bransin

    157 posts

    Thanks Sean, will do.

  • #4 / Mar 23, 2012 4:37pm

    Shane Eckert

    7174 posts

    Hey Bransin,

    I am glad to see that Sean was able to help you out.

    If you need anything else, please let us know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases