0

I create dynamic input by using jQuery

<input type="text" name="prices[]" value="1" />
<input type="text" name="prices[]" value="2" />
<input type="text" name="prices[]" value="3" />

I try with this code but It not work.

protected $rules = [
    'title'             => 'required|min:3',
    'state'             => 'required',
    'prices'            => 'required|integer',
    // 'prices[]'            => 'required|integer' // Or
];
5
  • 1
    You will have to build a custom validator rule that loops over the array. What exactly do you want to validate? Commented Jan 18, 2015 at 11:56
  • 1
    stackoverflow.com/questions/18161785/… - check the 3rd answer, works perfectly Commented Jan 18, 2015 at 12:37
  • @EimantasGabrielius I've followed Ronald Hulshof's guide but I got a message: Undefined offset: 1 at line: if (!is_array($parameters[1])) Commented Jan 18, 2015 at 15:17
  • 1
    I said check 3rd answer, not 2nd Commented Jan 18, 2015 at 16:12
  • Thank you, but I got this message: 502 Bad Gateway. I'm using Homestead Commented Jan 18, 2015 at 19:01

0

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.