unable to submit form after a condition is true

unable to submit form after a condition is true

Hi,
I have the following code, but I am able to prevent the form submit when the qty is less than the min bid amount but unable to submit the form when the qty is greater than min bid.

first time if input qty with a lesser value and then input the qty value greater than min_bid then the form is unable to submit.

If I input qty value greater than min_bid amount in the first time then I am able to submit the  form 

Please help

  1. <form class="form-inline" method="post" id="auctionform" action="<?php  echo base_url(); ?>orders/create">
  2.   <div class="form-group" id="bid_tab">
  3.   <label class="fee_text" for="registration_fee">Registration fee</label>
  4.      <label class="money_symbol " for="registration_fee">₹</label>
  5.      <label class="fee" for="registration_fee"><?php  echo $content->starting_bid; ?></label>
  6.                       <input type="hidden" name="amount" value="<?php echo $content->starting_bid; ?>" >
  7.                           <input type="hidden" name="exp_id" value="<?php echo $content->id; ?>" >
  8.                           <input type="hidden" name="exptype" value="<?php echo $content->exptype; ?>" >
  9.  </div>
  10.  <div class="form-group" id="bid_tab">
  11.    <label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
  12.    <div class="input-group">
  13.      <div class="input-group-addon">₹</div>
  14.      <input type="text" class="form-control btn-block" id="qty" name="qty" placeholder="Amount">
  15.      <div class="input-group-addon" style="padding-left: 35px; padding-right: 35px;">MINIMUM NEXT BID ₹ <?php echo $qty;  ?></div>
  16.    </div>
  17.  </div>
  18. <br>
  19. <div class="col-md-12 form-group">
  20. <div class="checkbox">
  21.    <label><br><br>
  22.   <input id="agree" type="checkbox" checked> I Accept  all terms and conditions
  23.    </label>
  24.  </div><br><br>
  25. <!--  <button type="submit" id="make_payment" class="btn btn-default btn-block">MAKE PAYMENT</button>-->
  26.                    <?php  if(isset($_SESSION['user_type']) && ($_SESSION['user_type']=="client")){ ?>
  27. <button type="button" id="make_payment" class="btn btn-default btn-block">MAKE PAYMENTS</button>
  28.                         <?php  }else{ ?>
  29.                         <a href="#" id="bid_btn" class="text-uppercase btn btn-default btn-block"  data-toggle="modal" data-target="#myModal_login">Login to Buy </a>
  30.                         <?php } ?>
  31.                   </div>
  32.                   
  33.                   
  34.                   </form>



  35. <!--   JAVASCRIPT ------------->


  36.  <script>
  37.    $(document).ready(function(){
  38.  
  39. $("#make_payment").on("click", function(event) {
  40. var qty=$("#qty").val();
  41. var min_bid=5200;
  42. alert("qty="+qty + "   "+ "min bid="+ min_bid);
  43. if(qty > min_bid)
  44. {
  45. alert("bid amount is greater");
  46. $("#auctionform").submit();
  47. }
  48. else if(qty < min_bid){ 
  49. alert('Bid amount cannot be less than next bid amount');
  50. $("#auctionform").submit(function(event) {event.preventDefault();});
  51. }
  52. }); 
  53.  
  54.    });
  55.    </script>


I am not sure where I am missing something.


Please help.