You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
2.0 KiB

10 years ago
10 years ago
  1. // This file depends heavily on jquery, jquery validation, jquery ui and bootstrap.js. So be nice and include them on the page.
  2. $(function () {
  3. $('form').validate();
  4. $('input.datepickerify').datepicker($.datepicker.regional["fa"]);
  5. /* Setup tooltip */
  6. $('.form-help').each(function () {
  7. if ($(this).data('for') != undefined) {
  8. $('#' + $(this).data('for')).tooltip({ trigger: 'focus', title: $(this).attr('title'), placement: 'left' });
  9. }
  10. $(this).tooltip();
  11. });
  12. // $('.assess-inputs').each(function () {
  13. // $(this).bind('submit', function (e) {
  14. //var alert = '<div class="alert alert-info fade in rtl"><button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">×</button><h4>فرم شما خیلی خلوته!</h4><p>با این شرایط ما نمیتونیم به شما کمک کنیم. اگر مایل هستید اطلاعات بیشتری پر کنید.</p><p><button type="submit" class="btn btn-danger">ارسال آگهی</button></p></div>';
  15. //$(this).children('input[type=submit], button[type=submit]').fadeOut('fast')
  16. //$(this).prepend(alert);
  17. //$(this).data('sparse-alert-showed', 'true');
  18. //e.preventDefault();
  19. // });
  20. // });
  21. $(document).on('submit', 'form', function (e) {
  22. if ($(this).validate()) {
  23. $(this).find('button').attr('disabled', 'disabled');
  24. $(this).find('input[type=submit]').attr('disabled', 'disabled');
  25. }
  26. });
  27. //var i;
  28. //i = 0;
  29. //$('button[type=submit]').on('focus', function (e) {
  30. // if (i <= 0)
  31. // alert('اگر فیلدها را وارد کردید دوباره کلیک کنید!');
  32. // i++;
  33. //});
  34. //$("button[type=submit]").on("click", function (e) {
  35. // $(this).attr('disabled', 'disabled');
  36. //});
  37. //$("input[type=submit]").on("click", function (e) {
  38. // $(this).attr('disabled', 'disabled');
  39. //});
  40. });