setvalue.js 1017 B

12345678910111213141516171819202122232425262728293031323334353637
  1. $(function()
  2. {
  3. $('[name^=canSetValue]').change(function()
  4. {
  5. var checked = $(this).prop('checked');
  6. $(this).parents('.settingBox').find('.fieldBox').toggle(checked);
  7. $(this).parents('.settingBox').find('[name^=checkAll], [name^=fields]').prop('checked', checked);
  8. });
  9. $('[name^=checkAll]').change(function()
  10. {
  11. var checked = $(this).prop('checked');
  12. $(this).parents('.fieldBox').find('[name^=fields]').prop('checked', checked);
  13. });
  14. $('#submit').click(function()
  15. {
  16. /* Check if checked the fields to search. */
  17. var emptyValue = $('[name^=canSetValue]').prop('checked') && $('[name^=fields]:checked').length == 0;
  18. if(!emptyValue)
  19. {
  20. $('#ajaxForm').submit();
  21. return false;
  22. }
  23. bootbox.confirm(window.emptyValue, function(result)
  24. {
  25. if(result)
  26. {
  27. $('#ajaxForm').submit();
  28. }
  29. });
  30. return false;
  31. });
  32. });