0

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.

2
  • Nobody? I'm sure there's a way around as we can we use the '[]' in the name. I've tried 'list[0]' without any results =/ Commented May 20, 2010 at 9:48
  • I think the problem I'm facing is that all the elements have the same name: name="list[]", then the Javascript can't access to the list[number] I want, any idea? Commented May 20, 2010 at 10:06

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

try using something like:

{ required: true, minlength:2 }

or even without "required" rule

Comments

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.