2

The following selects should be mandatory:

<select id="area" class="input-xlarge">
  <option value="0" selected="selected"></option>
  <option value="A">A</option>
  <option value="B">B</option>
  <option value="C">C</option>
  <option value="D">D</option>
</select>

<select multiple="multiple" id="reason" class="input-xlarge">
  <option value="001">reason001</option>
  <option value="002">reason002</option>
  <option value="003">reason003</option>
</select>

But the following code doesn't work:

$("#form").validate({
  rules: {
    "area": {
      required: true
    },
    "reason": {
      required: true
    }
LA_
  • 19,823
  • 58
  • 172
  • 308
  • ` – Ohgodwhy Jun 25 '12 at 16:56
  • possible duplicate of [jQuery Validate Required Select](http://stackoverflow.com/questions/2901125/jquery-validate-required-select) – Esailija Jun 25 '12 at 16:58
  • @Ohgodwhy, it works with first field, but doesn't work with second. – LA_ Jun 25 '12 at 17:10

1 Answers1

0

Your select tags have no name attribute, which is what validation rules are based on since they are required for submittal as well as any server side validation

charlietfl
  • 170,828
  • 13
  • 121
  • 150