Advertisement
Guest User

Untitled

a guest
Mar 31st, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.05 KB | None | 0 0
  1. <!-- Bootstrap CSS v3 -->
  2. <link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css">
  3.  
  4. <!-- FormValidation CSS file -->
  5. <link rel="stylesheet" href="/vendor/formvalidation/dist/css/formValidation.min.css">
  6.  
  7.  
  8. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/bootstrap.min.css">
  9. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/font-awesome.min.css">
  10. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/animate.min.css">
  11. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/bootstrap-switch.min.css">
  12. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/checkbox3.min.css">
  13. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/jquery.dataTables.min.css">
  14. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/dataTables.bootstrap.css">
  15. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/lib/css/select2.min.css">
  16. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/css/date2.css">
  17. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/css/date3.css">
  18.  
  19. <!-- Include Bootstrap Datepicker -->
  20. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.min.css" />
  21. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker3.min.css" />
  22.  
  23.  
  24. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/css/style.css">
  25. <link rel="stylesheet" type="text/css" href="http://10.237.102.158/trainingV2/css/themes/flat-blue.css">
  26.  
  27. <script type="text/javascript" src="../lib/js/jquery.min2.js"></script>
  28.  
  29. <script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.min.js"></script>
  30.  
  31. <style type="text/css">
  32. /**
  33. * Override feedback icon position
  34. * See http://formvalidation.io/examples/adjusting-feedback-icon-position/
  35. */
  36. #eventForm .dateContainer .form-control-feedback {
  37. top: 0;
  38. right: -15px;
  39. }
  40. </style>
  41.  
  42. <form id="eventForm" method="post" class="form-horizontal">
  43. <div class="form-group">
  44. <label class="col-xs-3 control-label">Event</label>
  45. <div class="col-xs-5">
  46. <input type="text" class="form-control" name="name" />
  47. </div>
  48. </div>
  49.  
  50. <div class="form-group">
  51. <label class="col-xs-3 control-label">Start date</label>
  52. <div class="col-xs-5 dateContainer">
  53. <div class="input-group input-append date" id="startDatePicker">
  54. <input type="text" class="form-control" name="startDate" />
  55. <span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
  56. </div>
  57. </div>
  58. </div>
  59.  
  60. <div class="form-group">
  61. <label class="col-xs-3 control-label">End date</label>
  62. <div class="col-xs-5 dateContainer">
  63. <div class="input-group input-append date" id="endDatePicker">
  64. <input type="text" class="form-control" name="endDate" />
  65. <span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
  66. </div>
  67. </div>
  68. </div>
  69.  
  70. <div class="form-group">
  71. <div class="col-xs-5 col-xs-offset-3">
  72. <button type="submit" class="btn btn-default">Validate</button>
  73. </div>
  74. </div>
  75. </form>
  76.  
  77. <script>
  78. $(document).ready(function() {
  79. $('#startDatePicker')
  80. .datepicker({
  81. format: 'mm/dd/yyyy'
  82. })
  83. .on('changeDate', function(e) {
  84. // Revalidate the start date field
  85. $('#eventForm').formValidation('revalidateField', 'startDate');
  86. });
  87.  
  88. $('#endDatePicker')
  89. .datepicker({
  90. format: 'mm/dd/yyyy'
  91. })
  92. .on('changeDate', function(e) {
  93. $('#eventForm').formValidation('revalidateField', 'endDate');
  94. });
  95.  
  96. $('#eventForm')
  97. .formValidation({
  98. framework: 'bootstrap',
  99. icon: {
  100. valid: 'glyphicon glyphicon-ok',
  101. invalid: 'glyphicon glyphicon-remove',
  102. validating: 'glyphicon glyphicon-refresh'
  103. },
  104. fields: {
  105. name: {
  106. validators: {
  107. notEmpty: {
  108. message: 'The name is required'
  109. }
  110. }
  111. },
  112. startDate: {
  113. validators: {
  114. notEmpty: {
  115. message: 'The start date is required'
  116. },
  117. date: {
  118. format: 'MM/DD/YYYY',
  119. max: 'endDate',
  120. message: 'The start date is not a valid'
  121. }
  122. }
  123. },
  124. endDate: {
  125. validators: {
  126. notEmpty: {
  127. message: 'The end date is required'
  128. },
  129. date: {
  130. format: 'MM/DD/YYYY',
  131. min: 'startDate',
  132. message: 'The end date is not a valid'
  133. }
  134. }
  135. }
  136. }
  137. })
  138. .on('success.field.fv', function(e, data) {
  139. if (data.field === 'startDate' && !data.fv.isValidField('endDate')) {
  140. // We need to revalidate the end date
  141. data.fv.revalidateField('endDate');
  142. }
  143.  
  144. if (data.field === 'endDate' && !data.fv.isValidField('startDate')) {
  145. // We need to revalidate the start date
  146. data.fv.revalidateField('startDate');
  147. }
  148. });
  149. });
  150. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement