0

Suppose I have a field like

@for($i=0;$i<4;$i++)
  <input type="hidden" name="my_field[$i]" value="$i"/>
@endFor

now how we can validate if my_filed[] array element has at least two value. It means how to check if this array input field has two member?

1 Answer 1

0

Use count:

$myField = Input::get('my_field');
if (count($myField) >= 2) {
    // $this->rollOutTransformers();
}
Sign up to request clarification or add additional context in comments.

1 Comment

I think above code can be use after the form submit. How should we use that with JsValidation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.