Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="makeOrders">
- <table id="myDatatable" class="display datatable">
- <thead>
- <tr>
- <th>Part No</th>
- <th>Description</th>
- <th>Model No</th>
- <th>Available QTY</th>
- <th>Tick To Order</th>
- <th>Quantity</th>
- <!-- <th>Edit</th> -->
- </tr>
- </thead>
- <tbody>
- <!-- Iterating over the list sent from Controller -->
- <c:forEach var="list" items="${compatibility}">
- <tr>
- <td>${list.partNumber}</td>
- <td>${list.itemDescription}</td>
- <td>${list.compitableDevice}</td>
- <td><input type="text" id="avaliableQuantity"
- name="avaliableQuantity" class="form-control" readonly="readonly"
- value="${list.quantity}"></td>
- <td><input type="checkbox" class="form-group"
- id="checkedOrder" name="selectedItem"
- value="${list.partNumber},${list.compitableDevice},${list.itemDescription}"></td>
- <td><input type="text" id="quantity" name="quantity"
- class="form-control" onblur="compareQuantity()" value="" /></td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- </div>
- <script type="text/javascript">
- /*Compare available quantity with entered quantity*/
- function compareQuantity() {
- var ourAvaliableQuantity = document.getElementById("avaliableQuantity").value;
- var yourQuantity = document.getElementById("quantity").value;
- if ( ourAvaliableQuantity >= yourQuantity ) {
- alert("Your quantity (" +yourQuantity+ ") is less or equal to available quantity (" + ourAvaliableQuantity+ ") order.n You can now place your order");
- console.log("True,",yourQuantity + " is less than " + ourAvaliableQuantity);
- console.log("Place an Order");
- }else if(ourAvaliableQuantity < yourQuantity) {
- alert("Your order quantity (" +yourQuantity+ ") can not be greater than available quantity (" + ourAvaliableQuantity+ "). n Please enter less quantity");
- document.getElementById("quantity").value = "";
- console.log("False,",ourAvaliableQuantity + " is small than " + yourQuantity);
- console.log("You can not place an order, enter less quantity");
- console.log("Enter value between 1 till " +ourAvaliableQuantity+ " not more than " +ourAvaliableQuantity);
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement