Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
$validation->valid_string()
  • I'm creating validation for my authorization system. I keep get this error...
    Fatal error: Call to undefined method Fuel\Core\Fieldset_Field::valid_string() in C:\xampp\htdocs\markup-lv\fuel\app\classes\controller\a11n.php on line 14

    Here's code. Something is wrong with valid_string() method. (
    $validation->add( 'username', 'username' )
     ->add_rule('required')
     ->add_rule( 'min_length', 1 )
     ->add_rule( 'max_length', 255 )
     ->valid_string( array( 'alpha', 'uppercase', 'lowercase', 'numeric', 'dashes' ) );
    
  • There's nothing wrong with the valid_string() method, it's just that it doesn't exist as such.
    ->add_rule( 'valid_string', array( 'alpha', 'uppercase', 'lowercase', 'numeric', 'dashes' ) );
    
  • Oh... funny mistake. =D Thanks.
  • How would that work for a model?
    I tried this within my model and it does not work

    'username' => array(
    'data_type' => 'varchar',
    'label' => 'username',
    'validation' => array('required', 'min_length' => array(3), 'max_length' => array(150), 'valid_string' => array( 'alpha', 'uppercase', 'lowercase', 'numeric', 'dashes' )),
    'form' => array('type' => 'text'),
    )

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion