Thank you so much for the response!!!!!! I need it so that, if any one of those three are not empty, then ALL are valid. But what you gave me, all I have to do is make some minor changes, but the concept makes sense. Thank you!
I think I might know the answer to my follow up question, but just in case... if I add a method, can I pass it just an element, without a value to compare it to if I'm just checking if something exists inside it..
EDIT: What I said was very confusing, so please allow me to expand on that. This isn't exactly the same question... but I figure I'd keep my validator questions all in one place instead of all over the forum:
Suppose this HTML
- <form id="myform">
- <div id="wrapper">
- <div id="sometimes-exists>
- <p>This element only sometimes exists.</p>
- </div>
- <select name="selected" id="selected" multiple="multiple">
- <optionA>
- <optionB>
- <option etc etc etc>
- </select>
- </div>
- </form>
What I need to do is when I validate, I need to first check if the div "sometimes-exists" ...well...exists. If so, then just return valid, and move on. If this element doesn't exist, then the user MUST have selected at least one option in that select, Basically, when that element is there, there are predefined options the user must have, so they may not need to choose more.
So how can I validate the wrapping div for the contents inside it, if that's how I do it? Or do I validate the select, and then somehow check for the "sometimes-exists" element from there?
Thanks again!