views:

31

answers:

1

Hi,
I have a list of input type="file" with their names as list[]. Following this question, I was able to make the rules and messages working in my jQuery.
But I do need at least 2 elements of list[] to be filled and adding the rule required: true only works for the irst element of the list, any idea how do I do that?

Cheers,
Nicolas.

A: 

All right I fixed the problem.
I saw there that the key in a name property is optional in HTML, but I thought I could NOT specify the array key in the array name of an HTML form element.

So I just changed some PHP/HTML code -a very few words actually-, just to specify the key of each element created.
Then, I just used 'list[--NUMBER--]': { required: true, accept: "jpe?g|gif|png" }, to make my fields mandatory :)

Hope it will help some people around.

Nicolas.

Nicolas