Witam,

Potrzebuję zrobić validację formularza dla pola wyboru <select> za pomocą takiego standardowego validatora jQuery:

http://docs.jquery.com/Plugins/validation

Szukałem rozwiązania i znalazłem to:

http://forum.jquery.com/topic/jquery-valid...box-conditional

Niestety jednak nadal nie działa validacja pola wyboru <select>

Próbowałem też tak:

  1. $('#my_form').validate({
  2. rules: {
  3. title: {
  4. required: true
  5. },
  6. textarea: {
  7. required: true
  8. },
  9. price: {
  10. required: true,
  11. number: true
  12. },
  13. type: {
  14. required: function() {
  15. if(typeValue == 'none') {
  16. return true;
  17. }
  18. return false;
  19. }
  20. },
  21. location: {
  22. required: true
  23. }
  24. },
  25. messages: {
  26. title: {
  27. required: 'This field is required.'
  28. },
  29. textarea: {
  30. required: 'This field is required.'
  31. },
  32. price: {
  33. required: 'This field is required.',
  34. number: 'Please enter a valid number.'
  35. },
  36. type: {
  37. required: 'This field is required.'
  38. },
  39. location: {
  40. required: 'This field is required.'
  41. }
  42. }
  43. });


kod w html:
  1. <select name="type" id="type" data-mini="true" placeholder="Type">
  2. <option value="none">Select type</option>
  3. <?php foreach ($types as $type): ?>
  4. <option value="<?php echo $type; ?>"><?php echo $type ?></option>
  5. <?php endforeach; ?>
  6. </select>



czego może mi brakować ? .. dzięki