Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Wrong Validation..?
  • Hi,

    When i use:
    $new_task_form->add('count_bots', 'Anzahl Bots (maximal '.count(\Bots\Bots::get_all_bots(\Auth::get('owned_bots'), false)).' verfügbar)', array('class' => 'input-small'), array('required', array('numeric_max', array(count(\Bots\Bots::get_all_bots(\Auth::get('owned_bots'), false)))), array('valid_string', array('numeric'))));

    --> \Bots\Bots::get_all_bots(\Auth::get('owned_bots'), false)) is 5

    And type in 3 I get the error:
    The maximum numeric value of Anzahl Bots (maximal 5 verfügbar) must be 5

    Could you help me?

    Thanks! :-)
  • You made a typo:

    $new_task_form->add('count_bots', 'Anzahl Bots (maximal
    '.count(\Bots\Bots::get_all_bots(\Auth::get('owned_bots'), false)).'
    verfügbar)', array('class' => 'input-small'), array('required',
    array('numeric_max',
    array(count(\Bots\Bots::get_all_bots(\Auth::get('owned_bots'),
    false)))), array('valid_string', array('numeric'))));

    should be

    $new_task_form->add(
        'count_bots',
        'Anzahl Bots (maximal '.count(\Bots\Bots::get_all_bots(\Auth::get('owned_bots'), false)).' verfügbar)',
        array('class' => 'input-small'),
        array(
            'required',
            array('numeric_max', count(\Bots\Bots::get_all_bots(\Auth::get('owned_bots'), false))),
            array('valid_string', array('numeric'))
        )
    );

    Don't think the count should be in an array, numeric_max doesn't take multiple values.

Howdy, Stranger!

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

In this Discussion